aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAaron Ballman <aaron@aaronballman.com>2012-07-16 15:45:33 +0000
committerAaron Ballman <aaron@aaronballman.com>2012-07-16 15:45:33 +0000
commit177f1be7fe5b7d71a791901fb83d95e18c413513 (patch)
treece2775cbcfbc7c3ec78f00a7fac4884e9261f369
parent6e39d05d4e0babbc9cc2bcec0c02394a45ec727a (diff)
Fixing an MSVC warning -- the compiler did not like the cast added to work around a g++ bug (it would claim to possibly emit incorrect code).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160281 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--include/clang/AST/RecursiveASTVisitor.h12
1 files changed, 10 insertions, 2 deletions
diff --git a/include/clang/AST/RecursiveASTVisitor.h b/include/clang/AST/RecursiveASTVisitor.h
index 1a61255f04..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).
- // The cast here is necessary to work around a bug in old versions of g++.
#define DISPATCH_WALK(NAME, CLASS, VAR) \
if (&RecursiveASTVisitor::Traverse##NAME == \
- (bool (RecursiveASTVisitor::*)(CLASS*))&Derived::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;
}