libclang visitation for DependentScopeDeclRefExpr

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112975 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Douglas Gregor 2010-09-03 17:24:10 +00:00
Родитель 34916dbb10
Коммит bfebed2a83
2 изменённых файлов: 31 добавлений и 0 удалений

Просмотреть файл

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

Просмотреть файл

@ -392,6 +392,7 @@ public:
bool VisitCXXPseudoDestructorExpr(CXXPseudoDestructorExpr *E); bool VisitCXXPseudoDestructorExpr(CXXPseudoDestructorExpr *E);
// 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);
}; };
} // end anonymous namespace } // end anonymous namespace
@ -1636,6 +1637,31 @@ bool CursorVisitor::VisitOverloadExpr(OverloadExpr *E) {
return false; 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) { bool CursorVisitor::VisitObjCMessageExpr(ObjCMessageExpr *E) {
if (TypeSourceInfo *TSInfo = E->getClassReceiverTypeInfo()) if (TypeSourceInfo *TSInfo = E->getClassReceiverTypeInfo())
if (Visit(TSInfo->getTypeLoc())) if (Visit(TSInfo->getTypeLoc()))