[llvm-branch-commits] [cfe-branch] r119642 - /cfe/branches/Apple/whitney/tools/libclang/CIndex.cpp
Daniel Dunbar
daniel at zuster.org
Wed Nov 17 18:37:14 PST 2010
Author: ddunbar
Date: Wed Nov 17 20:37:14 2010
New Revision: 119642
URL: http://llvm.org/viewvc/llvm-project?rev=119642&view=rev
Log:
Merge r118989:
--
Author: Ted Kremenek <kremenek at apple.com>
Date: Sat Nov 13 05:55:53 2010 +0000
CursorVisitor: migrate CXXNewExpr and CXXDefaultArgExpr over to data-recursive algorithm.
Modified:
cfe/branches/Apple/whitney/tools/libclang/CIndex.cpp
Modified: cfe/branches/Apple/whitney/tools/libclang/CIndex.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/whitney/tools/libclang/CIndex.cpp?rev=119642&r1=119641&r2=119642&view=diff
==============================================================================
--- cfe/branches/Apple/whitney/tools/libclang/CIndex.cpp (original)
+++ cfe/branches/Apple/whitney/tools/libclang/CIndex.cpp Wed Nov 17 20:37:14 2010
@@ -334,9 +334,7 @@
bool VisitDesignatedInitExpr(DesignatedInitExpr *E);
bool VisitCXXTypeidExpr(CXXTypeidExpr *E);
bool VisitCXXUuidofExpr(CXXUuidofExpr *E);
- bool VisitCXXDefaultArgExpr(CXXDefaultArgExpr *E) { return false; }
bool VisitCXXScalarValueInitExpr(CXXScalarValueInitExpr *E);
- bool VisitCXXNewExpr(CXXNewExpr *E);
bool VisitCXXPseudoDestructorExpr(CXXPseudoDestructorExpr *E);
bool VisitUnaryTypeTraitExpr(UnaryTypeTraitExpr *E);
bool VisitDependentScopeDeclRefExpr(DependentScopeDeclRefExpr *E);
@@ -348,7 +346,9 @@
DATA_RECURSIVE_VISIT(BinaryOperator)
DATA_RECURSIVE_VISIT(BlockExpr)
DATA_RECURSIVE_VISIT(CompoundLiteralExpr)
+ DATA_RECURSIVE_VISIT(CXXDefaultArgExpr)
DATA_RECURSIVE_VISIT(CXXMemberCallExpr)
+ DATA_RECURSIVE_VISIT(CXXNewExpr)
DATA_RECURSIVE_VISIT(CXXOperatorCallExpr)
DATA_RECURSIVE_VISIT(CXXTemporaryObjectExpr)
DATA_RECURSIVE_VISIT(DeclRefExpr)
@@ -1584,29 +1584,6 @@
return false;
}
-bool CursorVisitor::VisitCXXNewExpr(CXXNewExpr *E) {
- // Visit placement arguments.
- for (unsigned I = 0, N = E->getNumPlacementArgs(); I != N; ++I)
- if (Visit(MakeCXCursor(E->getPlacementArg(I), StmtParent, TU)))
- return true;
-
- // Visit the allocated type.
- if (TypeSourceInfo *TSInfo = E->getAllocatedTypeSourceInfo())
- if (Visit(TSInfo->getTypeLoc()))
- return true;
-
- // Visit the array size, if any.
- if (E->isArray() && Visit(MakeCXCursor(E->getArraySize(), StmtParent, TU)))
- return true;
-
- // Visit the initializer or constructor arguments.
- for (unsigned I = 0, N = E->getNumConstructorArgs(); I != N; ++I)
- if (Visit(MakeCXCursor(E->getConstructorArg(I), StmtParent, TU)))
- return true;
-
- return false;
-}
-
bool CursorVisitor::VisitCXXPseudoDestructorExpr(CXXPseudoDestructorExpr *E) {
// Visit base expression.
if (Visit(MakeCXCursor(E->getBase(), StmtParent, TU)))
@@ -1765,6 +1742,8 @@
void VisitBlockExpr(BlockExpr *B);
void VisitCompoundLiteralExpr(CompoundLiteralExpr *E);
void VisitCompoundStmt(CompoundStmt *S);
+ void VisitCXXDefaultArgExpr(CXXDefaultArgExpr *E) { /* Do nothing. */ }
+ void VisitCXXNewExpr(CXXNewExpr *E);
void VisitCXXOperatorCallExpr(CXXOperatorCallExpr *E);
void VisitCXXTemporaryObjectExpr(CXXTemporaryObjectExpr *E);
void VisitDeclRefExpr(DeclRefExpr *D);
@@ -1827,7 +1806,19 @@
E = S->body_rend(); I != E; ++I) {
AddStmt(*I);
}
-}
+}
+void EnqueueVisitor::VisitCXXNewExpr(CXXNewExpr *E) {
+ // Enqueue the initializer or constructor arguments.
+ for (unsigned I = E->getNumConstructorArgs(); I > 0; --I)
+ AddStmt(E->getConstructorArg(I-1));
+ // Enqueue the array size, if any.
+ AddStmt(E->getArraySize());
+ // Enqueue the allocated type.
+ AddTypeLoc(E->getAllocatedTypeSourceInfo());
+ // Enqueue the placement arguments.
+ for (unsigned I = E->getNumPlacementArgs(); I > 0; --I)
+ AddStmt(E->getPlacementArg(I-1));
+}
void EnqueueVisitor::VisitCXXOperatorCallExpr(CXXOperatorCallExpr *CE) {
// Note that we enqueue things in reverse order so that
// they are visited correctly by the DFS.
@@ -1987,7 +1978,9 @@
case Stmt::CaseStmtClass:
case Stmt::CompoundLiteralExprClass:
case Stmt::CompoundStmtClass:
+ case Stmt::CXXDefaultArgExprClass:
case Stmt::CXXMemberCallExprClass:
+ case Stmt::CXXNewExprClass:
case Stmt::CXXOperatorCallExprClass:
case Stmt::CXXTemporaryObjectExprClass:
case Stmt::DefaultStmtClass:
More information about the llvm-branch-commits
mailing list