[llvm-branch-commits] [cfe-branch] r119634 - /cfe/branches/Apple/whitney/tools/libclang/CIndex.cpp
Daniel Dunbar
daniel at zuster.org
Wed Nov 17 18:36:56 PST 2010
Author: ddunbar
Date: Wed Nov 17 20:36:55 2010
New Revision: 119634
URL: http://llvm.org/viewvc/llvm-project?rev=119634&view=rev
Log:
Merge r118934:
--
Author: Ted Kremenek <kremenek at apple.com>
Date: Fri Nov 12 22:24:57 2010 +0000
CursorVisitor: Pull ObjCMessageExpr and explicit casts into data-recursion 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=119634&r1=119633&r2=119634&view=diff
==============================================================================
--- cfe/branches/Apple/whitney/tools/libclang/CIndex.cpp (original)
+++ cfe/branches/Apple/whitney/tools/libclang/CIndex.cpp Wed Nov 17 20:36:55 2010
@@ -373,7 +373,6 @@
// Expression visitors
bool VisitDeclRefExpr(DeclRefExpr *E);
bool VisitBlockExpr(BlockExpr *B);
- bool VisitExplicitCastExpr(ExplicitCastExpr *E);
bool VisitObjCEncodeExpr(ObjCEncodeExpr *E);
bool VisitOffsetOfExpr(OffsetOfExpr *E);
bool VisitSizeOfAlignOfExpr(SizeOfAlignOfExpr *E);
@@ -399,6 +398,7 @@
DATA_RECURSIVE_VISIT(CompoundLiteralExpr)
DATA_RECURSIVE_VISIT(CXXMemberCallExpr)
DATA_RECURSIVE_VISIT(CXXOperatorCallExpr)
+ DATA_RECURSIVE_VISIT(ExplicitCastExpr)
DATA_RECURSIVE_VISIT(DoStmt)
DATA_RECURSIVE_VISIT(IfStmt)
DATA_RECURSIVE_VISIT(InitListExpr)
@@ -1595,14 +1595,6 @@
return VisitExpr(E);
}
-bool CursorVisitor::VisitExplicitCastExpr(ExplicitCastExpr *E) {
- if (TypeSourceInfo *TSInfo = E->getTypeInfoAsWritten())
- if (Visit(TSInfo->getTypeLoc()))
- return true;
-
- return VisitCastExpr(E);
-}
-
bool CursorVisitor::VisitAddrLabelExpr(AddrLabelExpr *E) {
return Visit(MakeCursorLabelRef(E->getLabel(), E->getLabelLoc(), TU));
}
@@ -1839,8 +1831,16 @@
WL.push_back(OverloadExprParts(E, Parent));
}
+// FIXME: Refactor into StmtVisitor?
void CursorVisitor::EnqueueWorkList(VisitorWorkList &WL, Stmt *S) {
CXCursor C = MakeCXCursor(S, StmtParent, TU);
+
+ if (ExplicitCastExpr *E = dyn_cast<ExplicitCastExpr>(S)) {
+ EnqueueChildren(WL, C, S);
+ WLAddTypeLoc(WL, C, cast<ExplicitCastExpr>(S)->getTypeInfoAsWritten());
+ return;
+ }
+
switch (S->getStmtClass()) {
default:
EnqueueChildren(WL, C, S);
@@ -1979,10 +1979,15 @@
switch (S->getStmtClass()) {
default: {
- // Perform default visitation for other cases.
- if (Visit(Cursor))
- return true;
- continue;
+ // FIXME: this entire switch stmt will eventually
+ // go away.
+ if (!isa<ExplicitCastExpr>(S)) {
+ // Perform default visitation for other cases.
+ if (Visit(Cursor))
+ return true;
+ continue;
+ }
+ // Fall-through.
}
case Stmt::BinaryOperatorClass:
case Stmt::CallExprClass:
More information about the llvm-branch-commits
mailing list