-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[clang][ExtractAPI] fix a couple crashes when used via libclang #132297
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
// Test is line- and column-sensitive. Run lines are below | ||
|
||
template <typename T> | ||
class basic_vector { | ||
public: | ||
T x; | ||
T y; | ||
}; | ||
|
||
using my_vec = basic_vector<int>; | ||
|
||
class MyClass { | ||
my_vec myVec; | ||
}; | ||
|
||
struct OuterStruct { | ||
struct InnerStruct; | ||
int outer_field; | ||
}; | ||
|
||
// RUN: c-index-test -single-symbol-sgf-at=%s:13:7 local %s | FileCheck --check-prefix=CHECK-VEC-TYPE %s | ||
// CHECK-VEC-TYPE: "parentContexts":[{"kind":"c++.typealias","name":"my_vec","usr":"c:@my_vec"}] | ||
// CHECK-VEC-TYPE: "declarationFragments":[{"kind":"keyword","spelling":"typedef"},{"kind":"text","spelling":" "},{"kind":"typeIdentifier","preciseIdentifier":"c:@ST>1#T@basic_vector","spelling":"basic_vector"},{"kind":"text","spelling":"<"},{"kind":"typeIdentifier","preciseIdentifier":"c:I","spelling":"int"},{"kind":"text","spelling":"> "},{"kind":"identifier","spelling":"my_vec"},{"kind":"text","spelling":";"}] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not an issue for this change, but I guess for further C++ support we might want to correctly record the spelled keyword Might be an editorial choice to use a consistent type alias keyword, but it might be better to preserve the actual spelling. Plus I think there are some minor distinctions and eligible contexts between the two. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Definitely but this should definitely be handled in a follow up patch. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Right, i agree that this is good, but we should track that separately. |
||
// CHECK-VEC-TYPE: "identifier":{"interfaceLanguage":"c++","precise":"c:@my_vec"} | ||
// CHECK-VEC-TYPE: "kind":{"displayName":"Type Alias","identifier":"c++.typealias"} | ||
// CHECK-VEC-TYPE: "title":"my_vec" | ||
// CHECK-VEC-TYPE: "pathComponents":["my_vec"] | ||
|
||
// RUN: c-index-test -single-symbol-sgf-at=%s:13:13 local %s | FileCheck --check-prefix=CHECK-MYVEC %s | ||
// CHECK-MYVEC: "parentContexts":[{"kind":"c++.class","name":"MyClass","usr":"c:@S@MyClass"},{"kind":"c++.property","name":"myVec","usr":"c:@S@MyClass@FI@myVec"}] | ||
// CHECK-MYVEC: "identifier":{"interfaceLanguage":"c++","precise":"c:@S@MyClass@FI@myVec"} | ||
// CHECK-MYVEC: "kind":{"displayName":"Instance Property","identifier":"c++.property"} | ||
zixu-w marked this conversation as resolved.
Show resolved
Hide resolved
|
||
// CHECK-MYVEC: "title":"myVec" | ||
// CHECK-MYVEC: "pathComponents":["MyClass","myVec"] | ||
|
||
// RUN: c-index-test -single-symbol-sgf-at=%s:17:17 local %s | FileCheck --check-prefix=CHECK-INNER %s | ||
// CHECK-INNER: "parentContexts":[{"kind":"c++.struct","name":"OuterStruct","usr":"c:@S@OuterStruct"},{"kind":"c++.struct","name":"InnerStruct","usr":"c:@S@OuterStruct@S@InnerStruct"}] | ||
// CHECK-INNER: "identifier":{"interfaceLanguage":"c++","precise":"c:@S@OuterStruct@S@InnerStruct"} | ||
// CHECK-INNER: "kind":{"displayName":"Structure","identifier":"c++.struct"} | ||
// CHECK-INNER: "title":"InnerStruct" | ||
// CHECK-INNER: "pathComponents":["OuterStruct","InnerStruct"] |
Uh oh!
There was an error while loading. Please reload this page.