diff --git a/clang/test/Index/load-stmts.cpp b/clang/test/Index/load-stmts.cpp index 9d183de13e35..9614e11a01bc 100644 --- a/clang/test/Index/load-stmts.cpp +++ b/clang/test/Index/load-stmts.cpp @@ -52,6 +52,7 @@ void test_dependent_exprs(T t) { typedef T type; N::g(t); type::template f(t); + t->type::template f(); } // RUN: c-index-test -test-load-source all %s | FileCheck %s @@ -132,3 +133,6 @@ void test_dependent_exprs(T t) { // CHECK: load-stmts.cpp:54:3: TypeRef=type:52:13 Extent=[54:3 - 54:7] // CHECK: load-stmts.cpp:54:20: TypeRef=type:52:13 Extent=[54:20 - 54:24] // CHECK: load-stmts.cpp:54:27: DeclRefExpr=t:50:29 Extent=[54:27 - 54:28] +// CHECK: load-stmts.cpp:55:3: CallExpr= Extent=[55:3 - 55:31] +// CHECK: load-stmts.cpp:55:3: DeclRefExpr=t:50:29 Extent=[55:3 - 55:4] +// CHECK: load-stmts.cpp:55:23: TypeRef=type:52:13 Extent=[55:23 - 55:27] diff --git a/clang/tools/libclang/CIndex.cpp b/clang/tools/libclang/CIndex.cpp index d75853b65d27..19dd44b8cf28 100644 --- a/clang/tools/libclang/CIndex.cpp +++ b/clang/tools/libclang/CIndex.cpp @@ -393,6 +393,7 @@ public: // FIXME: UnaryTypeTraitExpr has poor source-location information. bool VisitOverloadExpr(OverloadExpr *E); bool VisitDependentScopeDeclRefExpr(DependentScopeDeclRefExpr *E); + bool VisitCXXDependentScopeMemberExpr(CXXDependentScopeMemberExpr *E); }; } // end anonymous namespace @@ -1662,6 +1663,37 @@ bool CursorVisitor::VisitDependentScopeDeclRefExpr( return false; } +bool CursorVisitor::VisitCXXDependentScopeMemberExpr( + CXXDependentScopeMemberExpr *E) { + // Visit the base expression, if there is one. + if (!E->isImplicitAccess() && + Visit(MakeCXCursor(E->getBase(), StmtParent, TU))) + return true; + + // Visit the nested-name-specifier. + if (NestedNameSpecifier *Qualifier = E->getQualifier()) + if (VisitNestedNameSpecifier(Qualifier, E->getQualifierRange())) + return true; + + // Visit the declaration name. + if (VisitDeclarationNameInfo(E->getMemberNameInfo())) + 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; + } + } + + return false; +} + + bool CursorVisitor::VisitObjCMessageExpr(ObjCMessageExpr *E) { if (TypeSourceInfo *TSInfo = E->getClassReceiverTypeInfo()) if (Visit(TSInfo->getTypeLoc()))