aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNAKAMURA Takumi <geek4civic@gmail.com>2012-07-19 02:27:55 +0000
committerNAKAMURA Takumi <geek4civic@gmail.com>2012-07-19 02:27:55 +0000
commitce40e6f3dc3287348fb51a0eb7d4654b317435b8 (patch)
tree77a99dd186b3db94ca752e29be7124c7312189bc
parent7dfbfb1835198bf0cb4b0caaa5d9f3c6301f9920 (diff)
Revert r160404, "Eliminating the GCC_CAST hack, take two.", for now.
It crashes mingw32-gcc-4.4. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160486 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--include/clang/AST/RecursiveASTVisitor.h14
1 files changed, 11 insertions, 3 deletions
diff --git a/include/clang/AST/RecursiveASTVisitor.h b/include/clang/AST/RecursiveASTVisitor.h
index b30b178807..2e56a486f3 100644
--- a/include/clang/AST/RecursiveASTVisitor.h
+++ b/include/clang/AST/RecursiveASTVisitor.h
@@ -464,12 +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::*DerivedFn)(CLASS*) = &Derived::Traverse##NAME) \
- if (bool (Derived::*BaseFn)(CLASS*) = &RecursiveASTVisitor::Traverse##NAME)\
- if (DerivedFn == BaseFn) \
+ 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));
@@ -509,6 +516,7 @@ bool RecursiveASTVisitor<Derived>::dataTraverseNode(Stmt *S,
}
#undef DISPATCH_WALK
+#undef GCC_CAST
return true;
}