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

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

index 7a519c1be72dad4268e0100e76bb01f198af6402..9d183de13e35507ee1f29f7325a853137c85f150 100644 (file)
@@ -51,6 +51,7 @@ void test_dependent_exprs(T t) {
   N::f(t);
   typedef T type;
   N::g<type>(t);
+  type::template f<type*>(t);
 }
 
 // RUN: c-index-test -test-load-source all %s | FileCheck %s
@@ -127,3 +128,7 @@ void test_dependent_exprs(T t) {
 // 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]
+// CHECK: load-stmts.cpp:54:3: CallExpr= Extent=[54:3 - 54:29]
+// 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]
index 17afeca4970df3b27f674242277524bcd0769875..d75853b65d27ab15b1049deff75bf62d71e6f99e 100644 (file)
@@ -392,6 +392,7 @@ public:
   bool VisitCXXPseudoDestructorExpr(CXXPseudoDestructorExpr *E);
   // FIXME: UnaryTypeTraitExpr has poor source-location information.
   bool VisitOverloadExpr(OverloadExpr *E);
+  bool VisitDependentScopeDeclRefExpr(DependentScopeDeclRefExpr *E);
 };
 
 } // end anonymous namespace
@@ -1636,6 +1637,31 @@ bool CursorVisitor::VisitOverloadExpr(OverloadExpr *E) {
   return false;
 }
 
+bool CursorVisitor::VisitDependentScopeDeclRefExpr(
+                                                DependentScopeDeclRefExpr *E) {
+  // Visit the nested-name-specifier.
+  if (NestedNameSpecifier *Qualifier = E->getQualifier())
+    if (VisitNestedNameSpecifier(Qualifier, E->getQualifierRange()))
+      return true;
+
+  // Visit the declaration name.
+  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;
+    }
+  }
+
+  return false;
+}
+
 bool CursorVisitor::VisitObjCMessageExpr(ObjCMessageExpr *E) {
   if (TypeSourceInfo *TSInfo = E->getClassReceiverTypeInfo())
     if (Visit(TSInfo->getTypeLoc()))