[cfe-commits] r45984 - /cfe/trunk/include/clang/AST/CFG.h

Ted Kremenek kremenek at apple.com
Mon Jan 14 15:18:55 PST 2008


Author: kremenek
Date: Mon Jan 14 17:18:55 2008
New Revision: 45984

URL: http://llvm.org/viewvc/llvm-project?rev=45984&view=rev
Log:
Added operator[] for CFGBlock.  This provides random access to the statements
of a block.

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

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

==============================================================================
--- cfe/trunk/include/clang/AST/CFG.h (original)
+++ cfe/trunk/include/clang/AST/CFG.h Mon Jan 14 17:18:55 2008
@@ -103,7 +103,10 @@
   
   unsigned                     size()        const { return Stmts.size();    }
   bool                         empty()       const { return Stmts.empty();   }
-    
+
+  Stmt*& operator[](size_t i)        { assert (i < size()); return Stmts[i]; }
+  Stmt*  operator[](size_t i) const  { assert (i < size()); return Stmts[i]; }
+  
   // CFG iterators
   typedef AdjacentBlocks::iterator                              pred_iterator;
   typedef AdjacentBlocks::const_iterator                  const_pred_iterator;





More information about the cfe-commits mailing list