-
Notifications
You must be signed in to change notification settings - Fork 243
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: support emitting USRs for other kinds of declarations (#3268)
- Loading branch information
Showing
8 changed files
with
149 additions
and
4 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// We index USRs for aliases. | ||
|
||
//- @Int defines/binding Int | ||
//- IntUsr /clang/usr Int | ||
//- IntUsr.node/kind clang/usr | ||
using Int = int; | ||
|
||
//- @Short defines/binding Short | ||
//- ShortUsr /clang/usr Short | ||
//- ShortUsr.node/kind clang/usr | ||
typedef short Short; | ||
|
||
struct S { | ||
//- @Float defines/binding Float | ||
//- FloatUsr /clang/usr Float | ||
//- FloatUsr.node/kind clang/usr | ||
using Float = float; | ||
}; | ||
|
||
void f() { | ||
//- @Double defines/binding Double | ||
//- !{_ /clang/usr Double} | ||
using Double = double; | ||
} |
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,11 @@ | ||
// We index USRs for enums. | ||
|
||
//- @E defines/binding E | ||
//- EUsr /clang/usr E | ||
//- EUsr.node/kind clang/usr | ||
enum E { | ||
//- @Etor defines/binding Etor | ||
//- EtorUsr /clang/usr Etor | ||
//- EtorUsr.node/kind clang/usr | ||
Etor | ||
}; |
2 changes: 1 addition & 1 deletion
2
kythe/cxx/indexer/cxx/testdata/basic/usr.cc → ...ndexer/cxx/testdata/basic/usr_function.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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
// We index USRs. | ||
// We index USRs for functions. | ||
|
||
//- @foo defines/binding Foo | ||
//- FooUsr /clang/usr Foo | ||
|
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,30 @@ | ||
// We index USRs for records. | ||
|
||
//- @C defines/binding C | ||
//- CUsr /clang/usr C | ||
//- CUsr.node/kind clang/usr | ||
class C; | ||
|
||
//- @U defines/binding U | ||
//- UUsr /clang/usr U | ||
//- UUsr.node/kind clang/usr | ||
union U; | ||
|
||
//- @S defines/binding S | ||
//- SUsr /clang/usr S | ||
//- SUsr.node/kind clang/usr | ||
struct S { | ||
//- @m defines/binding M | ||
//- MUsr /clang/usr M | ||
//- MUsr.node/kind clang/usr | ||
int m; | ||
|
||
//- @f defines/binding F | ||
//- FUsr /clang/usr F | ||
//- FUsr.node/kind clang/usr | ||
void f() { | ||
//- @l defines/binding L | ||
//- !{_ /clang/usr L} | ||
int l; | ||
} | ||
}; |
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,16 @@ | ||
// We index USRs for variables. | ||
|
||
//- @global defines/binding Global | ||
//- GlobalUSR /clang/usr Global | ||
//- GlobalUSR.node/kind clang/usr | ||
int global; | ||
|
||
//- @param defines/binding Param | ||
//- !{_ /clang/usr Param} | ||
void f(int param) { } | ||
|
||
void g() { | ||
//- @local defines/binding Local | ||
//- !{_ /clang/usr Local} | ||
int local; | ||
} |