Add libclang visitation for C++ typeid expressions.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112862 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/tools/libclang/CIndex.cpp b/tools/libclang/CIndex.cpp
index 28751d2..2b3364c 100644
--- a/tools/libclang/CIndex.cpp
+++ b/tools/libclang/CIndex.cpp
@@ -384,6 +384,7 @@
bool VisitVAArgExpr(VAArgExpr *E);
// FIXME: InitListExpr (for the designators)
// FIXME: DesignatedInitExpr
+ bool VisitCXXTypeidExpr(CXXTypeidExpr *E);
};
} // end anonymous namespace
@@ -1567,6 +1568,17 @@
return Visit(MakeCXCursor(E->getSubExpr(), StmtParent, TU));
}
+bool CursorVisitor::VisitCXXTypeidExpr(CXXTypeidExpr *E) {
+ if (E->isTypeOperand()) {
+ if (TypeSourceInfo *TSInfo = E->getTypeOperandSourceInfo())
+ return Visit(TSInfo->getTypeLoc());
+
+ return false;
+ }
+
+ return VisitExpr(E);
+}
+
bool CursorVisitor::VisitObjCMessageExpr(ObjCMessageExpr *E) {
if (TypeSourceInfo *TSInfo = E->getClassReceiverTypeInfo())
if (Visit(TSInfo->getTypeLoc()))