[cfe-commits] r112975 - in /cfe/trunk: test/Index/load-stmts.cpp tools/libclang/CIndex.cpp
Douglas Gregor
dgregor at apple.com
Fri Sep 3 10:24:11 PDT 2010
Author: dgregor
Date: Fri Sep 3 12:24:10 2010
New Revision: 112975
URL: http://llvm.org/viewvc/llvm-project?rev=112975&view=rev
Log:
libclang visitation for DependentScopeDeclRefExpr
Modified:
cfe/trunk/test/Index/load-stmts.cpp
cfe/trunk/tools/libclang/CIndex.cpp
Modified: cfe/trunk/test/Index/load-stmts.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Index/load-stmts.cpp?rev=112975&r1=112974&r2=112975&view=diff
==============================================================================
--- cfe/trunk/test/Index/load-stmts.cpp (original)
+++ cfe/trunk/test/Index/load-stmts.cpp Fri Sep 3 12:24:10 2010
@@ -51,6 +51,7 @@
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 @@
// 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]
Modified: cfe/trunk/tools/libclang/CIndex.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/libclang/CIndex.cpp?rev=112975&r1=112974&r2=112975&view=diff
==============================================================================
--- cfe/trunk/tools/libclang/CIndex.cpp (original)
+++ cfe/trunk/tools/libclang/CIndex.cpp Fri Sep 3 12:24:10 2010
@@ -392,6 +392,7 @@
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 @@
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()))
More information about the cfe-commits
mailing list