[PATCH] D82760: RecursiveASTVisitor: inline a macro that is only used once

Dmitri Gribenko via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jun 29 05:54:19 PDT 2020


gribozavr created this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.
gribozavr2 added reviewers: eduucaldas, ymandel.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D82760

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


Index: clang/include/clang/AST/RecursiveASTVisitor.h
===================================================================
--- clang/include/clang/AST/RecursiveASTVisitor.h
+++ clang/include/clang/AST/RecursiveASTVisitor.h
@@ -669,9 +669,6 @@
   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 @@
 #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 @@
   return true;
 }
 
-#undef DISPATCH
-
 template <typename Derived>
 bool RecursiveASTVisitor<Derived>::TraverseNestedNameSpecifier(
     NestedNameSpecifier *NNS) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D82760.274074.patch
Type: text/x-patch
Size: 1205 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200629/6d578fc5/attachment-0001.bin>


More information about the cfe-commits mailing list