[cfe-commits] r160397 - /cfe/trunk/include/clang/AST/RecursiveASTVisitor.h

Douglas Gregor dgregor at apple.com
Tue Jul 17 14:27:49 PDT 2012


Author: dgregor
Date: Tue Jul 17 16:27:49 2012
New Revision: 160397

URL: http://llvm.org/viewvc/llvm-project?rev=160397&view=rev
Log:
Try to eliminate GCC_CAST hack in a manner that should work for both
GCC and MSVC.

Modified:
    cfe/trunk/include/clang/AST/RecursiveASTVisitor.h

Modified: cfe/trunk/include/clang/AST/RecursiveASTVisitor.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/RecursiveASTVisitor.h?rev=160397&r1=160396&r2=160397&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/RecursiveASTVisitor.h (original)
+++ cfe/trunk/include/clang/AST/RecursiveASTVisitor.h Tue Jul 17 16:27:49 2012
@@ -464,19 +464,11 @@
 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 (&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<CLASS*>(VAR)); \
   EnqueueChildren = false; \
   return getDerived().Traverse##NAME(static_cast<CLASS*>(VAR));
@@ -516,7 +508,6 @@
   }
 
 #undef DISPATCH_WALK
-#undef GCC_CAST
 
   return true;
 }





More information about the cfe-commits mailing list