diff options
author | Jordan Rose <jordan_rose@apple.com> | 2012-07-20 18:50:48 +0000 |
---|---|---|
committer | Jordan Rose <jordan_rose@apple.com> | 2012-07-20 18:50:48 +0000 |
commit | fd8b43596478b779b6777cb3a595e69d7856c378 (patch) | |
tree | d41f1e4ff28a634d30fa5c977910a9378427874a /lib/Analysis/CFG.cpp | |
parent | b379718fea4a3ce854e52cd06618412204cf171b (diff) |
Add a reverse iterator to DeclStmt, and use it when building a CFG.
The CFG creates dummy DeclStmts with one Decl per statement, and it has
to do so from last to first in order to build the graph correctly.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160560 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/CFG.cpp')
-rw-r--r-- | lib/Analysis/CFG.cpp | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/lib/Analysis/CFG.cpp b/lib/Analysis/CFG.cpp index e141ed9a44..1e3fa90c37 100644 --- a/lib/Analysis/CFG.cpp +++ b/lib/Analysis/CFG.cpp @@ -1527,11 +1527,10 @@ CFGBlock *CFGBuilder::VisitDeclStmt(DeclStmt *DS) { CFGBlock *B = 0; - // FIXME: Add a reverse iterator for DeclStmt to avoid this extra copy. - typedef SmallVector<Decl*,10> BufTy; - BufTy Buf(DS->decl_begin(), DS->decl_end()); - - for (BufTy::reverse_iterator I = Buf.rbegin(), E = Buf.rend(); I != E; ++I) { + // Build an individual DeclStmt for each decl. + for (DeclStmt::reverse_decl_iterator I = DS->decl_rbegin(), + E = DS->decl_rend(); + I != E; ++I) { // Get the alignment of the new DeclStmt, padding out to >=8 bytes. unsigned A = llvm::AlignOf<DeclStmt>::Alignment < 8 ? 8 : llvm::AlignOf<DeclStmt>::Alignment; |