[llvm-branch-commits] [cfe-branch] r119648 - /cfe/branches/Apple/whitney/tools/libclang/CIndex.cpp
Daniel Dunbar
daniel at zuster.org
Wed Nov 17 18:37:28 PST 2010
Author: ddunbar
Date: Wed Nov 17 20:37:27 2010
New Revision: 119648
URL: http://llvm.org/viewvc/llvm-project?rev=119648&view=rev
Log:
Merge r119282:
--
Author: Ted Kremenek <kremenek at apple.com>
Date: Mon Nov 15 22:23:26 2010 +0000
Cast pointers instead of returning a new value within RunVisitorWorkList().
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=119648&r1=119647&r2=119648&view=diff
==============================================================================
--- cfe/branches/Apple/whitney/tools/libclang/CIndex.cpp (original)
+++ cfe/branches/Apple/whitney/tools/libclang/CIndex.cpp Wed Nov 17 20:37:27 2010
@@ -1674,9 +1674,9 @@
VisitorJob(parent, VisitorJob::DeclVisitKind,
d, isFirst ? (void*) 1 : (void*) 0) {}
static bool classof(const VisitorJob *VJ) {
- return VJ->getKind () == DeclVisitKind;
+ return VJ->getKind() == DeclVisitKind;
}
- Decl *get() { return static_cast<Decl*>(dataA);}
+ Decl *get() const { return static_cast<Decl*>(dataA); }
bool isFirst() const { return dataB ? true : false; }
};
@@ -1690,7 +1690,7 @@
return VJ->getKind() == TypeLocVisitKind;
}
- TypeLoc get() {
+ TypeLoc get() const {
QualType T = QualType::getFromOpaquePtr(dataA);
return TypeLoc(T, dataB);
}
@@ -1883,31 +1883,32 @@
bool CursorVisitor::RunVisitorWorkList(VisitorWorkList &WL) {
while (!WL.empty()) {
// Dequeue the worklist item.
- VisitorJob LI = WL.back(); WL.pop_back();
-
+ VisitorJob LI = WL.back();
+ WL.pop_back();
+
// Set the Parent field, then back to its old value once we're done.
SetParentRAII SetParent(Parent, StmtParent, LI.getParent());
switch (LI.getKind()) {
case VisitorJob::DeclVisitKind: {
- Decl *D = cast<DeclVisit>(LI).get();
+ Decl *D = cast<DeclVisit>(&LI)->get();
if (!D)
continue;
// For now, perform default visitation for Decls.
- if (Visit(MakeCXCursor(D, TU, cast<DeclVisit>(LI).isFirst())))
+ if (Visit(MakeCXCursor(D, TU, cast<DeclVisit>(&LI)->isFirst())))
return true;
continue;
}
case VisitorJob::TypeLocVisitKind: {
// Perform default visitation for TypeLocs.
- if (Visit(cast<TypeLocVisit>(LI).get()))
+ if (Visit(cast<TypeLocVisit>(&LI)->get()))
return true;
continue;
}
case VisitorJob::StmtVisitKind: {
- Stmt *S = cast<StmtVisit>(LI).get();
+ Stmt *S = cast<StmtVisit>(&LI)->get();
if (!S)
continue;
@@ -1941,7 +1942,7 @@
case Stmt::CXXDependentScopeMemberExprClass:
if (Visit(Cursor))
return true;
- continue;
+ break;
default:
if (!IsInRegionOfInterest(Cursor))
continue;
@@ -1954,12 +1955,13 @@
EnqueueWorkList(WL, S);
break;
}
- continue;
+ break;
}
+ continue;
}
case VisitorJob::MemberExprPartsKind: {
// Handle the other pieces in the MemberExpr besides the base.
- MemberExpr *M = cast<MemberExprParts>(LI).get();
+ MemberExpr *M = cast<MemberExprParts>(&LI)->get();
// Visit the nested-name-specifier
if (NestedNameSpecifier *Qualifier = M->getQualifier())
@@ -1982,7 +1984,7 @@
continue;
}
case VisitorJob::DeclRefExprPartsKind: {
- DeclRefExpr *DR = cast<DeclRefExprParts>(LI).get();
+ DeclRefExpr *DR = cast<DeclRefExprParts>(&LI)->get();
// Visit nested-name-specifier, if present.
if (NestedNameSpecifier *Qualifier = DR->getQualifier())
if (VisitNestedNameSpecifier(Qualifier, DR->getQualifierRange()))
@@ -2002,7 +2004,7 @@
continue;
}
case VisitorJob::OverloadExprPartsKind: {
- OverloadExpr *O = cast<OverloadExprParts>(LI).get();
+ OverloadExpr *O = cast<OverloadExprParts>(&LI)->get();
// Visit the nested-name-specifier.
if (NestedNameSpecifier *Qualifier = O->getQualifier())
if (VisitNestedNameSpecifier(Qualifier, O->getQualifierRange()))
More information about the llvm-branch-commits
mailing list