[cfe-commits] r57206 - /cfe/trunk/lib/AST/CFG.cpp
Ted Kremenek
kremenek at apple.com
Mon Oct 6 13:56:19 PDT 2008
Author: kremenek
Date: Mon Oct 6 15:56:19 2008
New Revision: 57206
URL: http://llvm.org/viewvc/llvm-project?rev=57206&view=rev
Log:
Use DeclStmt::decl_iterator to walk a group of Decl*'s instead of using the ScopedDecl chain.
Modified:
cfe/trunk/lib/AST/CFG.cpp
Modified: cfe/trunk/lib/AST/CFG.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/CFG.cpp?rev=57206&r1=57205&r2=57206&view=diff
==============================================================================
--- cfe/trunk/lib/AST/CFG.cpp (original)
+++ cfe/trunk/lib/AST/CFG.cpp Mon Oct 6 15:56:19 2008
@@ -69,11 +69,10 @@
return Ex ? &Ex + 1 : 0;
}
virtual decl_iterator decl_begin() {
- return getDecl();
+ return TheDecl;
}
virtual decl_iterator decl_end() {
- ScopedDecl* D = getDecl();
- return D ? D->getNextDeclarator() : 0;
+ return TheDecl ? TheDecl->getNextDeclarator() : 0;
}
};
@@ -379,17 +378,22 @@
}
case Stmt::DeclStmtClass: {
- ScopedDecl* D = cast<DeclStmt>(Terminator)->getDecl();
-
- if (!D->getNextDeclarator()) {
+ DeclStmt *DS = cast<DeclStmt>(Terminator);
+ if (DS->hasSolitaryDecl()) {
Block->appendStmt(Terminator);
- return WalkAST_VisitDeclSubExpr(D);
+ return WalkAST_VisitDeclSubExpr(DS->getSolitaryDecl());
}
else {
typedef llvm::SmallVector<ScopedDecl*,10> BufTy;
BufTy Buf;
CFGBlock* B = 0;
- do { Buf.push_back(D); D = D->getNextDeclarator(); } while (D);
+
+ // FIXME: Add a reverse iterator for DeclStmt to avoid this
+ // extra copy.
+ for (DeclStmt::decl_iterator DI=DS->decl_begin(), DE=DS->decl_end();
+ DI != DE; ++DI)
+ Buf.push_back(*DI);
+
for (BufTy::reverse_iterator I=Buf.rbegin(), E=Buf.rend(); I!=E; ++I) {
// Get the alignment of UnaryDeclStmt, padding out to >=8 bytes.
unsigned A = llvm::AlignOf<UnaryDeclStmt>::Alignment < 8
More information about the cfe-commits
mailing list