In libclang, visit the nested-name-specifier and explicitly-specified template arguments of a MemberExpr.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112860 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/tools/libclang/CIndex.cpp b/tools/libclang/CIndex.cpp
index 6367de3..28751d2 100644
--- a/tools/libclang/CIndex.cpp
+++ b/tools/libclang/CIndex.cpp
@@ -370,7 +370,6 @@
// Expression visitors
bool VisitDeclRefExpr(DeclRefExpr *E);
- // FIXME: MemberExpr with template arguments, nested-name-specifier
bool VisitCXXOperatorCallExpr(CXXOperatorCallExpr *E);
bool VisitBlockExpr(BlockExpr *B);
bool VisitCompoundLiteralExpr(CompoundLiteralExpr *E);
@@ -379,6 +378,7 @@
bool VisitObjCEncodeExpr(ObjCEncodeExpr *E);
bool VisitOffsetOfExpr(OffsetOfExpr *E);
bool VisitSizeOfAlignOfExpr(SizeOfAlignOfExpr *E);
+ bool VisitMemberExpr(MemberExpr *E);
// FIXME: AddrLabelExpr (once we have cursors for labels)
bool VisitTypesCompatibleExpr(TypesCompatibleExpr *E);
bool VisitVAArgExpr(VAArgExpr *E);
@@ -1511,6 +1511,34 @@
return VisitExpr(E);
}
+bool CursorVisitor::VisitMemberExpr(MemberExpr *E) {
+ // Visit the base expression.
+ if (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 any.
+ if (E->hasExplicitTemplateArgs()) {
+ for (const TemplateArgumentLoc *Arg = E->getTemplateArgs(),
+ *ArgEnd = Arg + E->getNumTemplateArgs();
+ Arg != ArgEnd;
+ ++Arg) {
+ if (VisitTemplateArgumentLoc(*Arg))
+ return true;
+ }
+ }
+
+ return false;
+}
+
bool CursorVisitor::VisitExplicitCastExpr(ExplicitCastExpr *E) {
if (TypeSourceInfo *TSInfo = E->getTypeInfoAsWritten())
if (Visit(TSInfo->getTypeLoc()))