Reinstate the GCC_CAST hack; I apparently did not appease GCC with r160397.

llvm-svn: 160401
This commit is contained in:
Douglas Gregor 2012-07-17 22:32:15 +00:00
parent 82ea947018
commit 9db5e14349
1 changed files with 11 additions and 2 deletions

View File

@ -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;
}