forked from OSchip/llvm-project
[clang][index] Index unresolved member expression as reference
Unresolved member expressions aren't indexed as references. Example code: ``` struct Foo { template <typename T> void bar(T t); }; template <typename T> void test(Foo F, T t) { F.bar(t); // Not indexed } ``` Reviewed By: hokein Differential Revision: https://reviews.llvm.org/D131091
This commit is contained in:
parent
961838cc13
commit
ee648c0ce0
|
@ -2090,6 +2090,14 @@ TEST(FindReferences, WithinAST) {
|
|||
[[f^oo]](s);
|
||||
}
|
||||
)cpp",
|
||||
R"cpp(// unresolved member expression
|
||||
struct Foo {
|
||||
template <typename T> void $decl[[b^ar]](T t);
|
||||
};
|
||||
template <typename T> void test(Foo F, T t) {
|
||||
F.[[bar]](t);
|
||||
}
|
||||
)cpp",
|
||||
|
||||
// Enum base
|
||||
R"cpp(
|
||||
|
|
|
@ -468,7 +468,7 @@ public:
|
|||
return true;
|
||||
}
|
||||
|
||||
bool VisitUnresolvedLookupExpr(UnresolvedLookupExpr *E) {
|
||||
bool VisitOverloadExpr(OverloadExpr *E) {
|
||||
SmallVector<SymbolRelation, 4> Relations;
|
||||
SymbolRoleSet Roles = getRolesForRef(E, Relations);
|
||||
for (auto *D : E->decls())
|
||||
|
|
|
@ -231,3 +231,12 @@ template <typename T> void bar() {
|
|||
foo<T>();
|
||||
// CHECK: [[@LINE-1]]:3 | function/C | foo | c:@FT@>1#Tfoo#v# | <no-cgname> | Ref,Call,RelCall,RelCont | rel: 1
|
||||
}
|
||||
|
||||
struct Foo {
|
||||
template <typename T> void bar();
|
||||
// CHECK: [[@LINE-1]]:30 | instance-method/C++ | bar | c:@S@Foo@FT@>1#Tbar#v# | <no-cgname> | Decl,RelChild | rel: 1
|
||||
};
|
||||
template <typename T> void baz(Foo f) {
|
||||
f.bar<T>();
|
||||
// CHECK: [[@LINE-1]]:5 | instance-method/C++ | bar | c:@S@Foo@FT@>1#Tbar#v# | <no-cgname> | Ref,Call,RelCall,RelCont | rel: 1
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue