[llvm-branch-commits] [cfe-branch] r119628 - /cfe/branches/Apple/whitney/tools/libclang/CIndex.cpp
Daniel Dunbar
daniel at zuster.org
Wed Nov 17 18:36:41 PST 2010
Author: ddunbar
Date: Wed Nov 17 20:36:41 2010
New Revision: 119628
URL: http://llvm.org/viewvc/llvm-project?rev=119628&view=rev
Log:
Merge r118911:
--
Author: Ted Kremenek <kremenek at apple.com>
Date: Fri Nov 12 18:27:01 2010 +0000
CursorVisitor: use 'WLAddStmt' and 'WLAddDecl' for adding to data-recursion worklist.
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=119628&r1=119627&r2=119628&view=diff
==============================================================================
--- cfe/branches/Apple/whitney/tools/libclang/CIndex.cpp (original)
+++ cfe/branches/Apple/whitney/tools/libclang/CIndex.cpp Wed Nov 17 20:36:41 2010
@@ -1894,14 +1894,10 @@
unsigned size = WL.size();
for (Stmt::child_iterator Child = S->child_begin(),
ChildEnd = S->child_end(); Child != ChildEnd; ++Child) {
- if (Stmt *child = *Child) {
- WL.push_back(StmtVisit(child, C));
- }
+ WLAddStmt(WL, C, *Child);
}
-
if (size == WL.size())
return;
-
// Now reverse the entries we just added. This will match the DFS
// ordering performed by the worklist.
VisitorWorkList::iterator I = WL.begin() + size, E = WL.end();
@@ -1912,18 +1908,17 @@
CXXOperatorCallExpr *CE = cast<CXXOperatorCallExpr>(S);
// Note that we enqueue things in reverse order so that
// they are visited correctly by the DFS.
-
for (unsigned I = 1, N = CE->getNumArgs(); I != N; ++I)
- WL.push_back(StmtVisit(CE->getArg(N-I), C));
+ WLAddStmt(WL, C, CE->getArg(N-I));
- WL.push_back(StmtVisit(CE->getCallee(), C));
- WL.push_back(StmtVisit(CE->getArg(0), C));
+ WLAddStmt(WL, C, CE->getCallee());
+ WLAddStmt(WL, C, CE->getArg(0));
break;
}
case Stmt::BinaryOperatorClass: {
BinaryOperator *B = cast<BinaryOperator>(S);
- WL.push_back(StmtVisit(B->getRHS(), C));
- WL.push_back(StmtVisit(B->getLHS(), C));
+ WLAddStmt(WL, C, B->getRHS());
+ WLAddStmt(WL, C, B->getLHS());
break;
}
case Stmt::IfStmtClass: {
@@ -1931,27 +1926,24 @@
WLAddStmt(WL, C, If->getElse());
WLAddStmt(WL, C, If->getThen());
WLAddStmt(WL, C, If->getCond());
- WLAddDecl(WL, C, If->getConditionVariable());
+ WLAddDecl(WL, C, If->getConditionVariable());
break;
}
case Stmt::MemberExprClass: {
MemberExpr *M = cast<MemberExpr>(S);
WL.push_back(MemberExprParts(M, C));
- WL.push_back(StmtVisit(M->getBase(), C));
+ WLAddStmt(WL, C, M->getBase());
break;
}
case Stmt::ParenExprClass: {
- WL.push_back(StmtVisit(cast<ParenExpr>(S)->getSubExpr(), C));
+ WLAddStmt(WL, C, cast<ParenExpr>(S)->getSubExpr());
break;
}
case Stmt::SwitchStmtClass: {
SwitchStmt *SS = cast<SwitchStmt>(S);
- if (Stmt *Body = SS->getBody())
- WL.push_back(StmtVisit(Body, C));
- if (Stmt *Cond = SS->getCond())
- WL.push_back(StmtVisit(Cond, C));
- if (VarDecl *Var = SS->getConditionVariable())
- WL.push_back(DeclVisit(Var, C));
+ WLAddStmt(WL, C, SS->getBody());
+ WLAddStmt(WL, C, SS->getCond());
+ WLAddDecl(WL, C, SS->getConditionVariable());
break;
}
}
@@ -2012,6 +2004,7 @@
case Stmt::MemberExprClass:
case Stmt::ParenExprClass:
case Stmt::SwitchStmtClass:
+ case Stmt::UnaryOperatorClass:
{
if (!IsInRegionOfInterest(Cursor))
continue;
More information about the llvm-branch-commits
mailing list