diff options
Diffstat (limited to 'clang/tools/CIndex/CIndex.cpp')
-rw-r--r-- | clang/tools/CIndex/CIndex.cpp | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/clang/tools/CIndex/CIndex.cpp b/clang/tools/CIndex/CIndex.cpp index 6cd545f53f4..a9889621c7d 100644 --- a/clang/tools/CIndex/CIndex.cpp +++ b/clang/tools/CIndex/CIndex.cpp @@ -292,6 +292,11 @@ public: // FIXME: LabelStmt label? bool VisitIfStmt(IfStmt *S); bool VisitSwitchStmt(SwitchStmt *S); + + // Expression visitors + bool VisitSizeOfAlignOfExpr(SizeOfAlignOfExpr *E); + bool VisitExplicitCastExpr(ExplicitCastExpr *E); + bool VisitCompoundLiteralExpr(CompoundLiteralExpr *E); }; } // end anonymous namespace @@ -824,6 +829,33 @@ bool CursorVisitor::VisitSwitchStmt(SwitchStmt *S) { return false; } +bool CursorVisitor::VisitSizeOfAlignOfExpr(SizeOfAlignOfExpr *E) { + if (E->isArgumentType()) { + if (TypeSourceInfo *TSInfo = E->getArgumentTypeInfo()) + return Visit(TSInfo->getTypeLoc()); + + return false; + } + + return VisitExpr(E); +} + +bool CursorVisitor::VisitExplicitCastExpr(ExplicitCastExpr *E) { + if (TypeSourceInfo *TSInfo = E->getTypeInfoAsWritten()) + if (Visit(TSInfo->getTypeLoc())) + return true; + + return VisitCastExpr(E); +} + +bool CursorVisitor::VisitCompoundLiteralExpr(CompoundLiteralExpr *E) { + if (TypeSourceInfo *TSInfo = E->getTypeSourceInfo()) + if (Visit(TSInfo->getTypeLoc())) + return true; + + return VisitExpr(E); +} + CXString CIndexer::createCXString(const char *String, bool DupString){ CXString Str; if (DupString) { |