[cfe-commits] r125183 - in /cfe/trunk: include/clang/AST/ include/clang/Basic/ lib/AST/ lib/CodeGen/ lib/Sema/ lib/StaticAnalyzer/Checkers/ tools/libclang/

Douglas Gregor dgregor at apple.com
Wed Feb 9 07:28:41 PST 2011


On Feb 9, 2011, at 12:16 AM, John McCall wrote:

> Author: rjmccall
> Date: Wed Feb  9 02:16:59 2011
> New Revision: 125183
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=125183&view=rev
> Log:
> Remove vtables from the Stmt hierarchy;  this was pretty easy as
> there were only three virtual methods of any significance.
> 
> The primary way to grab child iterators now is with
>  Stmt::child_range children();
>  Stmt::const_child_range children() const;
> where a child_range is just a std::pair of iterators suitable for
> being llvm::tie'd to some locals.  I've left the old child_begin()
> and child_end() accessors in place, but it's probably a substantial
> penalty to grab the iterators individually now, since the
> switch-based dispatch is kindof inherently slower than vtable
> dispatch.  Grabbing them together is probably a slight win over the
> status quo, although of course we could've achieved that with vtables, too.
> 
> I also reclassified SwitchCase (correctly) as an abstract Stmt
> class, which (as the first such class that wasn't an Expr subclass)
> required some fiddling in a few places.
> 
> There are somewhat gross metaprogramming hooks in place to ensure
> that new statements/expressions continue to implement
> getSourceRange() and children().  I had to work around a recent clang
> bug;  dgregor actually fixed it already, but I didn't want to
> introduce a selfhosting dependency on ToT.


Very nice!

Next up: Decls?

  - Doug



More information about the cfe-commits mailing list