[cfe-commits] r43132 - /cfe/trunk/AST/StmtIterator.cpp

Ted Kremenek kremenek at apple.com
Thu Oct 18 09:25:42 PDT 2007


Author: kremenek
Date: Thu Oct 18 11:25:40 2007
New Revision: 43132

URL: http://llvm.org/viewvc/llvm-project?rev=43132&view=rev
Log:
Fixed broken build.

Modified:
    cfe/trunk/AST/StmtIterator.cpp

Modified: cfe/trunk/AST/StmtIterator.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/AST/StmtIterator.cpp?rev=43132&r1=43131&r2=43132&view=diff

==============================================================================
--- cfe/trunk/AST/StmtIterator.cpp (original)
+++ cfe/trunk/AST/StmtIterator.cpp Thu Oct 18 11:25:40 2007
@@ -17,8 +17,31 @@
 
 using namespace clang;
 
-void StmtIterator::NextDecl() { assert(false); }
-void StmtIterator::PrevDecl() { assert(false); }
+void StmtIterator::NextDecl() {
+  assert (D);
+  do D = D->getNextDeclarator();
+  while (D != NULL && !isa<VarDecl>(D));
+  
+  if (!D) S = NULL;
+}
+
+void StmtIterator::PrevDecl() {
+  assert (isa<DeclStmt>(*S));
+  DeclStmt* DS = cast<DeclStmt>(*S);
+
+  ScopedDecl* d = DS->getDecl();
+  assert (d);
+  
+  if (d == D) { assert(false) ; return; }
+  
+  // March through the list of decls until we find the decl just before
+  // the one we currently point 
+  
+  while (d->getNextDeclarator() != D)
+    d = d->getNextDeclarator();
+  
+  D = d;
+}
 
 Stmt*& StmtIterator::GetInitializer() const {
   assert (D && isa<VarDecl>(D));





More information about the cfe-commits mailing list