From 0ea5a97dbb7b23c3e3d60b6dbd34ce0a32e44aef Mon Sep 17 00:00:00 2001 From: Douglas Gregor Date: Tue, 17 Jul 2012 21:27:49 +0000 Subject: [PATCH] Try to eliminate GCC_CAST hack in a manner that should work for both GCC and MSVC. llvm-svn: 160397 --- clang/include/clang/AST/RecursiveASTVisitor.h | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/clang/include/clang/AST/RecursiveASTVisitor.h b/clang/include/clang/AST/RecursiveASTVisitor.h index 2e56a486f3d0..fa272ffdc24a 100644 --- a/clang/include/clang/AST/RecursiveASTVisitor.h +++ b/clang/include/clang/AST/RecursiveASTVisitor.h @@ -464,19 +464,11 @@ template bool RecursiveASTVisitor::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 (&RecursiveASTVisitor::Traverse##NAME == \ - GCC_CAST(CLASS)&Derived::Traverse##NAME) \ + if ((bool (Derived::*)(CLASS*))&RecursiveASTVisitor::Traverse##NAME == \ + &Derived::Traverse##NAME) \ return getDerived().WalkUpFrom##NAME(static_cast(VAR)); \ EnqueueChildren = false; \ return getDerived().Traverse##NAME(static_cast(VAR)); @@ -516,7 +508,6 @@ bool RecursiveASTVisitor::dataTraverseNode(Stmt *S, } #undef DISPATCH_WALK -#undef GCC_CAST return true; }