[cfe-commits] r92070 - in /cfe/trunk: include/clang/AST/StmtIterator.h lib/AST/StmtIterator.cpp

Ted Kremenek kremenek at apple.com
Wed Dec 23 14:31:49 PST 2009


Author: kremenek
Date: Wed Dec 23 16:31:49 2009
New Revision: 92070

URL: http://llvm.org/viewvc/llvm-project?rev=92070&view=rev
Log:
Increase StmtIterator size by one pointer (separating out the Stmt** from the union including Decl* and Decl**).
This change is setup for adding StmtIterator support for condition variables in IfStmt, WhileStmt, etc.

Modified:
    cfe/trunk/include/clang/AST/StmtIterator.h
    cfe/trunk/lib/AST/StmtIterator.cpp

Modified: cfe/trunk/include/clang/AST/StmtIterator.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/StmtIterator.h?rev=92070&r1=92069&r2=92070&view=diff

==============================================================================
--- cfe/trunk/include/clang/AST/StmtIterator.h (original)
+++ cfe/trunk/include/clang/AST/StmtIterator.h Wed Dec 23 16:31:49 2009
@@ -28,11 +28,12 @@
 protected:
   enum { DeclMode = 0x1, SizeOfTypeVAMode = 0x2, DeclGroupMode = 0x3,
          Flags = 0x3 };
-
-  union { Stmt** stmt; Decl* decl; Decl** DGI; };
+  
+  Stmt **stmt;
+  union { Decl *decl; Decl **DGI; };
   uintptr_t RawVAPtr;
-  Decl** DGE;
-
+  Decl **DGE;
+  
   bool inDecl() const {
     return (RawVAPtr & Flags) == DeclMode;
   }
@@ -64,11 +65,11 @@
 
   Stmt*& GetDeclExpr() const;
 
-  StmtIteratorBase(Stmt** s) : stmt(s), RawVAPtr(0) {}
-  StmtIteratorBase(Decl* d);
-  StmtIteratorBase(VariableArrayType* t);
-  StmtIteratorBase(Decl** dgi, Decl** dge);
-  StmtIteratorBase() : stmt(NULL), RawVAPtr(0) {}
+  StmtIteratorBase(Stmt **s) : stmt(s), decl(0), RawVAPtr(0) {}
+  StmtIteratorBase(Decl *d);
+  StmtIteratorBase(VariableArrayType *t);
+  StmtIteratorBase(Decl **dgi, Decl **dge);
+  StmtIteratorBase() : stmt(0), decl(0), RawVAPtr(0) {}
 };
 
 
@@ -106,11 +107,11 @@
   }
 
   bool operator==(const DERIVED& RHS) const {
-    return stmt == RHS.stmt && RawVAPtr == RHS.RawVAPtr;
+    return stmt == RHS.stmt && decl == RHS.decl && RawVAPtr == RHS.RawVAPtr;
   }
 
   bool operator!=(const DERIVED& RHS) const {
-    return stmt != RHS.stmt || RawVAPtr != RHS.RawVAPtr;
+    return stmt != RHS.stmt || decl != RHS.decl || RawVAPtr != RHS.RawVAPtr;
   }
 
   REFERENCE operator*() const {

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

==============================================================================
--- cfe/trunk/lib/AST/StmtIterator.cpp (original)
+++ cfe/trunk/lib/AST/StmtIterator.cpp Wed Dec 23 16:31:49 2009
@@ -114,18 +114,18 @@
 }
 
 StmtIteratorBase::StmtIteratorBase(Decl* d)
-  : decl(d), RawVAPtr(DeclMode) {
+  : stmt(0), decl(d), RawVAPtr(DeclMode) {
   assert (decl);
   NextDecl(false);
 }
 
 StmtIteratorBase::StmtIteratorBase(Decl** dgi, Decl** dge)
-  : DGI(dgi), RawVAPtr(DeclGroupMode), DGE(dge) {
+  : stmt(0), DGI(dgi), RawVAPtr(DeclGroupMode), DGE(dge) {
   NextDecl(false);
 }
 
 StmtIteratorBase::StmtIteratorBase(VariableArrayType* t)
-: decl(0), RawVAPtr(SizeOfTypeVAMode) {
+  : stmt(0), decl(0), RawVAPtr(SizeOfTypeVAMode) {
   RawVAPtr |= reinterpret_cast<uintptr_t>(t);
 }
 





More information about the cfe-commits mailing list