aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2012-07-17 22:32:15 +0000
committerDouglas Gregor <dgregor@apple.com>2012-07-17 22:32:15 +0000
commit8de0956c736428c6aa2d317a8bad0c0c494ad6c3 (patch)
tree2b820a76e75a3be358d0fce9fa9f8c21feebdbb9
parenta444f1856459130bd3a1bb8995331c9e367db04f (diff)
Reinstate the GCC_CAST hack; I apparently did not appease GCC with r160397.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160401 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--include/clang/AST/RecursiveASTVisitor.h13
1 files changed, 11 insertions, 2 deletions
diff --git a/include/clang/AST/RecursiveASTVisitor.h b/include/clang/AST/RecursiveASTVisitor.h
index fa272ffdc2..2e56a486f3 100644
--- a/include/clang/AST/RecursiveASTVisitor.h
+++ b/include/clang/AST/RecursiveASTVisitor.h
@@ -464,11 +464,19 @@ template<typename Derived>
bool RecursiveASTVisitor<Derived>::dataTraverseNode(Stmt *S,
bool &EnqueueChildren) {
+// The cast for DISPATCH_WALK is needed for older versions of g++, but causes
+// problems for MSVC. So we'll skip the cast entirely for MSVC.
+#if defined(_MSC_VER)
+ #define GCC_CAST(CLASS)
+#else
+ #define GCC_CAST(CLASS) (bool (RecursiveASTVisitor::*)(CLASS*))
+#endif
+
// Dispatch to the corresponding WalkUpFrom* function only if the derived
// class didn't override Traverse* (and thus the traversal is trivial).
#define DISPATCH_WALK(NAME, CLASS, VAR) \
- if ((bool (Derived::*)(CLASS*))&RecursiveASTVisitor::Traverse##NAME == \
- &Derived::Traverse##NAME) \
+ if (&RecursiveASTVisitor::Traverse##NAME == \
+ GCC_CAST(CLASS)&Derived::Traverse##NAME) \
return getDerived().WalkUpFrom##NAME(static_cast<CLASS*>(VAR)); \
EnqueueChildren = false; \
return getDerived().Traverse##NAME(static_cast<CLASS*>(VAR));
@@ -508,6 +516,7 @@ bool RecursiveASTVisitor<Derived>::dataTraverseNode(Stmt *S,
}
#undef DISPATCH_WALK
+#undef GCC_CAST
return true;
}