CursorVisitor: migrate handling of CXXUuidofExpr to
data-recursion algorithm.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119444 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/tools/libclang/CIndex.cpp b/tools/libclang/CIndex.cpp
index 7f4bf66..f4e3557 100644
--- a/tools/libclang/CIndex.cpp
+++ b/tools/libclang/CIndex.cpp
@@ -340,7 +340,6 @@
bool VisitOffsetOfExpr(OffsetOfExpr *E);
bool VisitSizeOfAlignOfExpr(SizeOfAlignOfExpr *E);
bool VisitDesignatedInitExpr(DesignatedInitExpr *E);
- bool VisitCXXUuidofExpr(CXXUuidofExpr *E);
bool VisitCXXScalarValueInitExpr(CXXScalarValueInitExpr *E);
bool VisitCXXPseudoDestructorExpr(CXXPseudoDestructorExpr *E);
bool VisitDependentScopeDeclRefExpr(DependentScopeDeclRefExpr *E);
@@ -1511,17 +1510,6 @@
return Visit(MakeCXCursor(E->getInit(), StmtParent, TU));
}
-bool CursorVisitor::VisitCXXUuidofExpr(CXXUuidofExpr *E) {
- if (E->isTypeOperand()) {
- if (TypeSourceInfo *TSInfo = E->getTypeOperandSourceInfo())
- return Visit(TSInfo->getTypeLoc());
-
- return false;
- }
-
- return VisitExpr(E);
-}
-
bool CursorVisitor::VisitCXXScalarValueInitExpr(CXXScalarValueInitExpr *E) {
if (TypeSourceInfo *TSInfo = E->getTypeSourceInfo())
return Visit(TSInfo->getTypeLoc());
@@ -1696,6 +1684,7 @@
void VisitCXXTemporaryObjectExpr(CXXTemporaryObjectExpr *E);
void VisitCXXTypeidExpr(CXXTypeidExpr *E);
void VisitCXXUnresolvedConstructExpr(CXXUnresolvedConstructExpr *E);
+ void VisitCXXUuidofExpr(CXXUuidofExpr *E);
void VisitDeclRefExpr(DeclRefExpr *D);
void VisitDeclStmt(DeclStmt *S);
void VisitExplicitCastExpr(ExplicitCastExpr *E);
@@ -1804,6 +1793,11 @@
EnqueueChildren(E);
AddTypeLoc(E->getTypeSourceInfo());
}
+void EnqueueVisitor::VisitCXXUuidofExpr(CXXUuidofExpr *E) {
+ EnqueueChildren(E);
+ if (E->isTypeOperand())
+ AddTypeLoc(E->getTypeOperandSourceInfo());
+}
void EnqueueVisitor::VisitDeclRefExpr(DeclRefExpr *DR) {
if (DR->hasExplicitTemplateArgs()) {
AddExplicitTemplateArgs(&DR->getExplicitTemplateArgs());
@@ -1970,10 +1964,8 @@
case Stmt::OffsetOfExprClass:
case Stmt::SizeOfAlignOfExprClass:
case Stmt::DesignatedInitExprClass:
- case Stmt::CXXUuidofExprClass:
case Stmt::CXXScalarValueInitExprClass:
case Stmt::CXXPseudoDestructorExprClass:
- case Stmt::UnaryTypeTraitExprClass:
case Stmt::DependentScopeDeclRefExprClass:
case Stmt::CXXDependentScopeMemberExprClass:
if (Visit(Cursor))