]> granicus.if.org Git - clang/commitdiff
Fixed broken build.
authorTed Kremenek <kremenek@apple.com>
Thu, 18 Oct 2007 16:25:40 +0000 (16:25 +0000)
committerTed Kremenek <kremenek@apple.com>
Thu, 18 Oct 2007 16:25:40 +0000 (16:25 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43132 91177308-0d34-0410-b5e6-96231b3b80d8

AST/StmtIterator.cpp

index aca1f8109586bbc0d74622e83474b31e5645e420..16d8223a06e1814837823af32c9bd6109a0d5331 100644 (file)
 
 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));