-
Notifications
You must be signed in to change notification settings - Fork 244
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(cxx_indexer): Add support for member pointers and uses of them a… (
#3258) * feat(cxx_indexer): Add support for member pointers and uses of them as template parameters * fix(cxx_indexer): add space between pointee and class for member pointer marked source
- Loading branch information
Showing
7 changed files
with
173 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
kythe/cxx/indexer/cxx/testdata/rec/rec_class_member_ptr.cc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
//- @C defines/binding CDecl | ||
struct C { | ||
//- @member defines/binding MemberDecl | ||
int member; | ||
}; | ||
|
||
void fn() { | ||
//- @C ref CDecl | ||
//- @mptr defines/binding PtrDecl | ||
//- PtrDecl typed MemPtrType | ||
//- MemPtrType.node/kind tapp | ||
//- MemPtrType param.0 vname("mptr#builtin", "", "", "", "c++") | ||
//- MemPtrType param.1 vname("int#builtin", "", "", "", "c++") | ||
//- MemPtrType param.2 CDecl | ||
int C::* mptr; | ||
//- @C ref CDecl | ||
//- @member ref MemberDecl | ||
//- @mptr ref PtrDecl | ||
mptr = &C::member; | ||
} |
38 changes: 38 additions & 0 deletions
38
kythe/cxx/indexer/cxx/testdata/template/template_decl_arg.cc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
// Verify that we support using pointers, references and pointer-to-members in | ||
// non-type template parameters. | ||
|
||
template <typename Type, Type Value> | ||
struct Pair { | ||
using type = Type; | ||
static constexpr type value() { return Value; } | ||
}; | ||
|
||
//- @Value defines/binding ValueType | ||
struct Value { | ||
//- @member defines/binding ValueMember | ||
int member; | ||
}; | ||
|
||
//- @fn defines/binding FnDecl | ||
void fn(); | ||
|
||
//- @Alias defines/binding AliasDecl | ||
//- @Value ref ValueType | ||
//- @member ref ValueMember | ||
using Alias = Pair<decltype(&Value::member), | ||
//- @Value ref ValueType | ||
//- @member ref ValueMember | ||
&Value::member>; | ||
|
||
|
||
//- @FnPtrAlias defines/binding FnPtrAliasType | ||
//- @fn ref FnDecl | ||
using FnPtrAlias = Pair<decltype(&fn), | ||
//- @fn ref FnDecl | ||
&fn>; | ||
|
||
//- @FnRefAlias defines/binding FnRefAliasType | ||
//- @fn ref FnDecl | ||
using FnRefAlias = Pair<decltype(*fn), | ||
//- @fn ref FnDecl | ||
fn>; |