[clang] 58f2be9 - RecursiveASTVisitor: inline a macro that is only used once

Dmitri Gribenko via cfe-commits cfe-commits at lists.llvm.org
Mon Jun 29 08:09:25 PDT 2020


Author: Dmitri Gribenko
Date: 2020-06-29T17:06:30+02:00
New Revision: 58f2be9671a802acda2f74d2d8105a59ed119933

URL: https://github.com/llvm/llvm-project/commit/58f2be9671a802acda2f74d2d8105a59ed119933
DIFF: https://github.com/llvm/llvm-project/commit/58f2be9671a802acda2f74d2d8105a59ed119933.diff

LOG: RecursiveASTVisitor: inline a macro that is only used once

Reviewers: eduucaldas, ymandel

Reviewed By: ymandel

Subscribers: cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D82760

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/clang/include/clang/AST/RecursiveASTVisitor.h b/clang/include/clang/AST/RecursiveASTVisitor.h
index 9bbd390f61cd..3c2f561abcbf 100644
--- a/clang/include/clang/AST/RecursiveASTVisitor.h
+++ b/clang/include/clang/AST/RecursiveASTVisitor.h
@@ -669,9 +669,6 @@ bool RecursiveASTVisitor<Derived>::TraverseStmt(Stmt *S,
   return true;
 }
 
-#define DISPATCH(NAME, CLASS, VAR)                                             \
-  return getDerived().Traverse##NAME(static_cast<CLASS *>(VAR))
-
 template <typename Derived>
 bool RecursiveASTVisitor<Derived>::TraverseType(QualType T) {
   if (T.isNull())
@@ -681,7 +678,8 @@ bool RecursiveASTVisitor<Derived>::TraverseType(QualType T) {
 #define ABSTRACT_TYPE(CLASS, BASE)
 #define TYPE(CLASS, BASE)                                                      \
   case Type::CLASS:                                                            \
-    DISPATCH(CLASS##Type, CLASS##Type, const_cast<Type *>(T.getTypePtr()));
+    return getDerived().Traverse##CLASS##Type(                                 \
+        static_cast<CLASS##Type *>(const_cast<Type *>(T.getTypePtr())));
 #include "clang/AST/TypeNodes.inc"
   }
 
@@ -731,8 +729,6 @@ bool RecursiveASTVisitor<Derived>::TraverseDecl(Decl *D) {
   return true;
 }
 
-#undef DISPATCH
-
 template <typename Derived>
 bool RecursiveASTVisitor<Derived>::TraverseNestedNameSpecifier(
     NestedNameSpecifier *NNS) {


        


More information about the cfe-commits mailing list