diff options
| author | John McCall <rjmccall@apple.com> | 2010-05-16 02:09:32 +0000 |
|---|---|---|
| committer | John McCall <rjmccall@apple.com> | 2010-05-16 02:09:32 +0000 |
| commit | 3f435e6693ee199357e1fa6eb96d3a4c5f85d005 (patch) | |
| tree | 5dfd5a1f3a60b1b86c53e1409e5eea1c8f4ea6f5 | |
| parent | 51150ab1f13a9272d06e96f45ca2f10697b4b364 (diff) | |
| download | bcm5719-llvm-3f435e6693ee199357e1fa6eb96d3a4c5f85d005.tar.gz bcm5719-llvm-3f435e6693ee199357e1fa6eb96d3a4c5f85d005.zip | |
Avoid doing two switches in TypeLoc's initialize() loop. The optimizer
can probably do this for us, but it's actually somewhat nicer to write it
out here.
llvm-svn: 103893
| -rw-r--r-- | clang/lib/AST/TypeLoc.cpp | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/clang/lib/AST/TypeLoc.cpp b/clang/lib/AST/TypeLoc.cpp index fd9fbc19186..e66738a65da 100644 --- a/clang/lib/AST/TypeLoc.cpp +++ b/clang/lib/AST/TypeLoc.cpp @@ -92,9 +92,20 @@ namespace { /// recursively, as if the entire tree had been written in the /// given location. void TypeLoc::initializeImpl(TypeLoc TL, SourceLocation Loc) { - do { - TypeLocInitializer(Loc).Visit(TL); - } while ((TL = TL.getNextTypeLoc())); + while (true) { + switch (TL.getTypeLocClass()) { +#define ABSTRACT_TYPELOC(CLASS, PARENT) +#define TYPELOC(CLASS, PARENT) \ + case CLASS: { \ + CLASS##TypeLoc TLCasted = cast<CLASS##TypeLoc>(TL); \ + TLCasted.initializeLocal(Loc); \ + TL = TLCasted.getNextTypeLoc(); \ + if (!TL) return; \ + continue; \ + } +#include "clang/AST/TypeLocNodes.def" + } + } } namespace { |

