diff options
author | John McCall <rjmccall@apple.com> | 2011-02-09 08:16:59 +0000 |
---|---|---|
committer | John McCall <rjmccall@apple.com> | 2011-02-09 08:16:59 +0000 |
commit | 63c00d7f35fa060c0a446c9df3a4402d9c7757fe (patch) | |
tree | 64f68effbaf44e33590151cab184481c9313db35 /lib/Sema/TreeTransform.h | |
parent | f0ed580ea5cdc171973c1ac259a9ee21badb80d8 (diff) |
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.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125183 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/TreeTransform.h')
-rw-r--r-- | lib/Sema/TreeTransform.h | 8 |
1 files changed, 1 insertions, 7 deletions
diff --git a/lib/Sema/TreeTransform.h b/lib/Sema/TreeTransform.h index 2a82869786..bd110bd1f6 100644 --- a/lib/Sema/TreeTransform.h +++ b/lib/Sema/TreeTransform.h @@ -2280,6 +2280,7 @@ StmtResult TreeTransform<Derived>::TransformStmt(Stmt *S) { // Transform individual statement nodes #define STMT(Node, Parent) \ case Stmt::Node##Class: return getDerived().Transform##Node(cast<Node>(S)); +#define ABSTRACT_STMT(Node) #define EXPR(Node, Parent) #include "clang/AST/StmtNodes.inc" @@ -4831,13 +4832,6 @@ TreeTransform<Derived>::TransformDeclStmt(DeclStmt *S) { template<typename Derived> StmtResult -TreeTransform<Derived>::TransformSwitchCase(SwitchCase *S) { - assert(false && "SwitchCase is abstract and cannot be transformed"); - return SemaRef.Owned(S); -} - -template<typename Derived> -StmtResult TreeTransform<Derived>::TransformAsmStmt(AsmStmt *S) { ASTOwningVector<Expr*> Constraints(getSema()); |