summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn McCall <rjmccall@apple.com>2010-05-16 02:09:32 +0000
committerJohn McCall <rjmccall@apple.com>2010-05-16 02:09:32 +0000
commit3f435e6693ee199357e1fa6eb96d3a4c5f85d005 (patch)
tree5dfd5a1f3a60b1b86c53e1409e5eea1c8f4ea6f5
parent51150ab1f13a9272d06e96f45ca2f10697b4b364 (diff)
downloadbcm5719-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.cpp17
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 {
OpenPOWER on IntegriCloud