libclang visitation for CXXDependentScopeMemberExpr

llvm-svn: 112978
This commit is contained in:
Douglas Gregor 2010-09-03 17:35:34 +00:00
parent 9e42a952d7
commit 4583827e13
2 changed files with 36 additions and 0 deletions

View File

@ -52,6 +52,7 @@ void test_dependent_exprs(T t) {
typedef T type; typedef T type;
N::g<type>(t); N::g<type>(t);
type::template f<type*>(t); type::template f<type*>(t);
t->type::template f<type*>();
} }
// RUN: c-index-test -test-load-source all %s | FileCheck %s // 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: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: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: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]

View File

@ -393,6 +393,7 @@ public:
// FIXME: UnaryTypeTraitExpr has poor source-location information. // FIXME: UnaryTypeTraitExpr has poor source-location information.
bool VisitOverloadExpr(OverloadExpr *E); bool VisitOverloadExpr(OverloadExpr *E);
bool VisitDependentScopeDeclRefExpr(DependentScopeDeclRefExpr *E); bool VisitDependentScopeDeclRefExpr(DependentScopeDeclRefExpr *E);
bool VisitCXXDependentScopeMemberExpr(CXXDependentScopeMemberExpr *E);
}; };
} // end anonymous namespace } // end anonymous namespace
@ -1662,6 +1663,37 @@ bool CursorVisitor::VisitDependentScopeDeclRefExpr(
return false; 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) { bool CursorVisitor::VisitObjCMessageExpr(ObjCMessageExpr *E) {
if (TypeSourceInfo *TSInfo = E->getClassReceiverTypeInfo()) if (TypeSourceInfo *TSInfo = E->getClassReceiverTypeInfo())
if (Visit(TSInfo->getTypeLoc())) if (Visit(TSInfo->getTypeLoc()))