[cfe-commits] r45984 - /cfe/trunk/include/clang/AST/CFG.h
Chris Lattner
clattner at apple.com
Mon Jan 14 15:23:56 PST 2008
On Jan 14, 2008, at 3:18 PM, Ted Kremenek wrote:
> 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.
Is it a good idea to allow mutation through operator[] ? I'd expect a
const CFGBlock to return a const Stmt*, what do you think?
-Chris
>
>
> 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;
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
More information about the cfe-commits
mailing list