Commit Graph

11 Commits

Author SHA1 Message Date
Ted Kremenek 31974dfcdf Added support for StmtIterators to iterate over the size expressions
of VariableArrayTypes that appear in TypedefDecls.

for example:

  typedef int T[x][x];

the StmtIterator will iterate over "x" and "x" as subexpressions of
the DeclStmt for T.

llvm-svn: 43474
2007-10-29 21:38:03 +00:00
Ted Kremenek 899ef13376 Fixed deadcode bug where check for NULL decl occured within a block
where the decl would always be non-NULL.  Moved the check to after the
block to properly tidy up the iterator's state.

llvm-svn: 43473
2007-10-29 21:23:58 +00:00
Ted Kremenek 2f70e71dcc Modified StmtIterator to support iteration over the size expressions
of VariableTypeArray types that appear in DeclStmts.

Removed operator-- from StmtIterator.  operator-- added undesired
complexity, and we have no consumers of it.

llvm-svn: 43471
2007-10-29 20:50:16 +00:00
Ted Kremenek a80b257a21 Renamed internal variables of StmtIteratorBase to make the code
slightly more succinct.

Introduced VariableArrayType* within StmtIteratorBase to (soon)
support iteration over the size expressions of variable length arrays.

llvm-svn: 43455
2007-10-29 18:04:38 +00:00
Hartmut Kaiser d57aca25fc Disambiguated variable name to comply with VC++'s archaic variable scoping rules.
llvm-svn: 43371
2007-10-25 22:59:17 +00:00
Ted Kremenek 066f60321d Modified StmtIterator to now include visiting the initialization expression for EnumConstantDecls.
llvm-svn: 43366
2007-10-25 22:24:19 +00:00
Ted Kremenek 38f87dd9d0 Modified operator* for StmtIterator to return Stmt*& instead of Stmt*.
This permits in-place replacement of the original AST statements.

llvm-svn: 43295
2007-10-24 16:52:34 +00:00
Ted Kremenek 04746ce6f9 Fixed DeclStmt::child_begin() to actually create an iterator that
visits its decls, rather than just creating an "end()" iterator.

Fixed child_end() for statements and expressions to use
child_iterator() to create the end() iterator, rather than just
returning NULL.

Fixed bug in StmtIterator where we did not correctly detect if we had
marched off the end of the ScopedDecls.

llvm-svn: 43156
2007-10-18 23:28:49 +00:00
Ted Kremenek 2ba761c7b8 Refactored StmtIterator into classes StmtIteratorBase (non-templated)
and StmtIteratorImpl (templated), which StmtIterator and
ConstStmtIterator now succintly subclass.

Implemented iteration over the initializers in DeclStmts.  This is not
thoroughly tested, so there may be bugs.

llvm-svn: 43138
2007-10-18 18:19:31 +00:00
Ted Kremenek 7aef89101d Fixed broken build.
llvm-svn: 43132
2007-10-18 16:25:40 +00:00
Ted Kremenek 336886a344 Implemented 90% functionality of new child_iterator for Stmt objects
that will (soon) allow iteration over the initializers in
declarations.  This new iterator mechanism is implemented by the
classes StmtIterator and ConstStmtIterator.

Patched a few files to use "operator++" instead of "operator+" on
child_iterators.

Friendship added in VarDecl to StmtIterator to allow returning a
reference to the initializer within the VarDecl.  We may not wish this
as a permanent solution.

llvm-svn: 43105
2007-10-18 00:24:38 +00:00