[cfe-commits] r57186 - /cfe/trunk/include/clang/AST/Stmt.h

Ted Kremenek kremenek at apple.com
Mon Oct 6 11:35:56 PDT 2008


Author: kremenek
Date: Mon Oct  6 13:35:55 2008
New Revision: 57186

URL: http://llvm.org/viewvc/llvm-project?rev=57186&view=rev
Log:
Add const_decl_iterator to DecStmt.

Modified:
    cfe/trunk/include/clang/AST/Stmt.h

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

==============================================================================
--- cfe/trunk/include/clang/AST/Stmt.h (original)
+++ cfe/trunk/include/clang/AST/Stmt.h Mon Oct  6 13:35:55 2008
@@ -180,6 +180,29 @@
   virtual decl_iterator decl_begin() { return TheDecl; }
   virtual decl_iterator decl_end() { return 0; }
   
+  class const_decl_iterator {
+    decl_iterator Impl;
+  public:
+    const_decl_iterator(const ScopedDecl *d)
+      : Impl(const_cast<ScopedDecl*>(d)) {}
+    
+    bool operator==(const const_decl_iterator& I) const {
+      return Impl == I.Impl;
+    }
+    bool operator!=(const const_decl_iterator& I) const {
+      return Impl != I.Impl;
+    }
+    const ScopedDecl* operator*() const {
+      return *Impl;
+    }
+    const_decl_iterator& operator++() {
+      ++Impl; return *this;
+    }
+  };
+  
+  const_decl_iterator decl_begin() const { return TheDecl; }
+  const_decl_iterator decl_end() const { return 0; }
+  
   // Serialization.  
   virtual void EmitImpl(llvm::Serializer& S) const;
   static DeclStmt* CreateImpl(llvm::Deserializer& D, ASTContext& C);





More information about the cfe-commits mailing list