]> granicus.if.org Git - clang/commitdiff
libclang visitation for CXXDependentScopeMemberExpr
authorDouglas Gregor <dgregor@apple.com>
Fri, 3 Sep 2010 17:35:34 +0000 (17:35 +0000)
committerDouglas Gregor <dgregor@apple.com>
Fri, 3 Sep 2010 17:35:34 +0000 (17:35 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112978 91177308-0d34-0410-b5e6-96231b3b80d8

test/Index/load-stmts.cpp
tools/libclang/CIndex.cpp

index 9d183de13e35507ee1f29f7325a853137c85f150..9614e11a01bcd224285ff6b05bff050cdd2566fe 100644 (file)
@@ -52,6 +52,7 @@ void test_dependent_exprs(T t) {
   typedef T type;
   N::g<type>(t);
   type::template f<type*>(t);
+  t->type::template f<type*>();
 }
 
 // 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]
index d75853b65d27ab15b1049deff75bf62d71e6f99e..19dd44b8cf28c695378a517f2e480830c52afe75 100644 (file)
@@ -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()))