]> granicus.if.org Git - clang/commitdiff
Add libclang visitation for UnresolvedLookupExprs
authorDouglas Gregor <dgregor@apple.com>
Thu, 2 Sep 2010 22:19:24 +0000 (22:19 +0000)
committerDouglas Gregor <dgregor@apple.com>
Thu, 2 Sep 2010 22:19:24 +0000 (22:19 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112879 91177308-0d34-0410-b5e6-96231b3b80d8

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

index df21f2c7223448a0f68c334518e90bd009937f55..fdc0027ced3439f5d65bf4240f83d97ca27edbd4 100644 (file)
@@ -38,6 +38,16 @@ void test_exprs(C *c) {
   int_ptr->Integer::~Integer();
 }
 
+namespace N {
+  int f(int);
+  float f(float);
+}
+
+template<typename T>
+void test_dependent_exprs(T t) {
+  N::f(t);
+}
+
 // RUN: c-index-test -test-load-source all %s | FileCheck %s
 // CHECK: load-stmts.cpp:1:13: TypedefDecl=T:1:13 (Definition) Extent=[1:13 - 1:14]
 // CHECK: load-stmts.cpp:2:8: StructDecl=X:2:8 (Definition) Extent=[2:1 - 2:23]
@@ -103,3 +113,7 @@ void test_exprs(C *c) {
 // 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]
index d3c3c6e4face47e1bb6a347d0c223f2cb6453770..f30dd61ece752c2063c2c3dbdcb44f68008d8ef2 100644 (file)
@@ -386,10 +386,12 @@ public:
   // FIXME: DesignatedInitExpr
   bool VisitCXXTypeidExpr(CXXTypeidExpr *E);
   bool VisitCXXDefaultArgExpr(CXXDefaultArgExpr *E) { return false; }
-  // FIXME: CXXTemporaryObjectExpr has poor source-location information
-  // FIXME: CXXScalarValueInitExpr has poor source-location information
+  // FIXME: CXXTemporaryObjectExpr has poor source-location information.
+  // FIXME: CXXScalarValueInitExpr has poor source-location information.
   // FIXME: CXXNewExpr has poor source-location information
   bool VisitCXXPseudoDestructorExpr(CXXPseudoDestructorExpr *E);
+  // FIXME: UnaryTypeTraitExpr has poor source-location information.
+  bool VisitUnresolvedLookupExpr(UnresolvedLookupExpr *E);
 };
 
 } // end anonymous namespace
@@ -1608,6 +1610,21 @@ bool CursorVisitor::VisitCXXPseudoDestructorExpr(CXXPseudoDestructorExpr *E) {
   return false;
 }
 
+bool CursorVisitor::VisitUnresolvedLookupExpr(UnresolvedLookupExpr *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;
+  
+  // FIXME: We don't have a way to visit all of the declarations referenced
+  // here.
+  return false;
+}
+
 bool CursorVisitor::VisitObjCMessageExpr(ObjCMessageExpr *E) {
   if (TypeSourceInfo *TSInfo = E->getClassReceiverTypeInfo())
     if (Visit(TSInfo->getTypeLoc()))