forked from OSchip/llvm-project
Teach libclang to visit OverloadExprs, so that we can reuse this
code. Also, teach it about explicitly-specified template arguments. llvm-svn: 112884
This commit is contained in:
parent
7fd9aea67c
commit
f24eaee2b3
|
@ -41,11 +41,16 @@ void test_exprs(C *c) {
|
|||
namespace N {
|
||||
int f(int);
|
||||
float f(float);
|
||||
|
||||
template<typename T> T g(T);
|
||||
template<typename T> T g(T*);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
void test_dependent_exprs(T t) {
|
||||
N::f(t);
|
||||
typedef T type;
|
||||
N::g<type>(t);
|
||||
}
|
||||
|
||||
// RUN: c-index-test -test-load-source all %s | FileCheck %s
|
||||
|
@ -113,7 +118,12 @@ void test_dependent_exprs(T t) {
|
|||
// CHECK: load-stmts.cpp:38:3: DeclRefExpr=int_ptr:37:12 Extent=[38:3 - 38:10]
|
||||
// CHECK: load-stmts.cpp:38:12: TypeRef=Integer:36:15 Extent=[38:12 - 38:19]
|
||||
// CHECK: load-stmts.cpp:38:22: TypeRef=Integer:36:15 Extent=[38:22 - 38:29]
|
||||
// CHECK: load-stmts.cpp:47:6: FunctionTemplate=test_dependent_exprs:47:6 (Definition)
|
||||
// CHECK: load-stmts.cpp:48:3: CallExpr= Extent=[48:3 - 48:10]
|
||||
// CHECK: load-stmts.cpp:48:3: NamespaceRef=N:41:11 Extent=[48:3 - 48:4]
|
||||
// CHECK: load-stmts.cpp:48:8: DeclRefExpr=t:47:29 Extent=[48:8 - 48:9]
|
||||
// CHECK: load-stmts.cpp:50:6: FunctionTemplate=test_dependent_exprs:50:6 (Definition)
|
||||
// CHECK: load-stmts.cpp:51:3: CallExpr= Extent=[51:3 - 51:10]
|
||||
// CHECK: load-stmts.cpp:51:3: NamespaceRef=N:41:11 Extent=[51:3 - 51:4]
|
||||
// CHECK: load-stmts.cpp:51:8: DeclRefExpr=t:50:29 Extent=[51:8 - 51:9]
|
||||
// CHECK: load-stmts.cpp:52:13: TypedefDecl=type:52:13 (Definition) Extent=[52:13 - 52:17]
|
||||
// CHECK: load-stmts.cpp:53:3: CallExpr= Extent=[53:3 - 53:16]
|
||||
// CHECK: load-stmts.cpp:53:3: NamespaceRef=N:41:11 Extent=[53:3 - 53:4]
|
||||
// CHECK: load-stmts.cpp:53:8: TypeRef=type:52:13 Extent=[53:8 - 53:12]
|
||||
// CHECK: load-stmts.cpp:53:14: DeclRefExpr=t:50:29 Extent=[53:14 - 53:15]
|
||||
|
|
|
@ -391,7 +391,7 @@ public:
|
|||
// FIXME: CXXNewExpr has poor source-location information
|
||||
bool VisitCXXPseudoDestructorExpr(CXXPseudoDestructorExpr *E);
|
||||
// FIXME: UnaryTypeTraitExpr has poor source-location information.
|
||||
bool VisitUnresolvedLookupExpr(UnresolvedLookupExpr *E);
|
||||
bool VisitOverloadExpr(OverloadExpr *E);
|
||||
};
|
||||
|
||||
} // end anonymous namespace
|
||||
|
@ -1610,7 +1610,7 @@ bool CursorVisitor::VisitCXXPseudoDestructorExpr(CXXPseudoDestructorExpr *E) {
|
|||
return false;
|
||||
}
|
||||
|
||||
bool CursorVisitor::VisitUnresolvedLookupExpr(UnresolvedLookupExpr *E) {
|
||||
bool CursorVisitor::VisitOverloadExpr(OverloadExpr *E) {
|
||||
// Visit the nested-name-specifier.
|
||||
if (NestedNameSpecifier *Qualifier = E->getQualifier())
|
||||
if (VisitNestedNameSpecifier(Qualifier, E->getQualifierRange()))
|
||||
|
@ -1620,6 +1620,17 @@ bool CursorVisitor::VisitUnresolvedLookupExpr(UnresolvedLookupExpr *E) {
|
|||
if (VisitDeclarationNameInfo(E->getNameInfo()))
|
||||
return true;
|
||||
|
||||
// Visit the explicitly-specified template arguments.
|
||||
if (const ExplicitTemplateArgumentList *ArgList
|
||||
= E->getOptionalExplicitTemplateArgs()) {
|
||||
for (const TemplateArgumentLoc *Arg = ArgList->getTemplateArgs(),
|
||||
*ArgEnd = Arg + ArgList->NumTemplateArgs;
|
||||
Arg != ArgEnd; ++Arg) {
|
||||
if (VisitTemplateArgumentLoc(*Arg))
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// FIXME: We don't have a way to visit all of the declarations referenced
|
||||
// here.
|
||||
return false;
|
||||
|
|
Loading…
Reference in New Issue