[PATCH] D37662: [AST] Make RecursiveASTVisitor visit TemplateDecls in source order

Phabricator via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Sep 11 06:15:00 PDT 2017


This revision was automatically updated to reflect the committed changes.
Closed by commit rL312911: [AST] Make RecursiveASTVisitor visit TemplateDecls in source order (authored by krobelus).

Repository:
  rL LLVM

https://reviews.llvm.org/D37662

Files:
  cfe/trunk/include/clang/AST/LexicallyOrderedRecursiveASTVisitor.h
  cfe/trunk/include/clang/AST/RecursiveASTVisitor.h


Index: cfe/trunk/include/clang/AST/RecursiveASTVisitor.h
===================================================================
--- cfe/trunk/include/clang/AST/RecursiveASTVisitor.h
+++ cfe/trunk/include/clang/AST/RecursiveASTVisitor.h
@@ -537,7 +537,6 @@
 
   bool dataTraverseNode(Stmt *S, DataRecursionQueue *Queue);
   bool PostVisitStmt(Stmt *S);
-  bool shouldTraverseTemplateArgumentsBeforeDecl() const { return false; }
 };
 
 template <typename Derived>
@@ -1691,13 +1690,8 @@
 // template declarations.
 #define DEF_TRAVERSE_TMPL_DECL(TMPLDECLKIND)                                   \
   DEF_TRAVERSE_DECL(TMPLDECLKIND##TemplateDecl, {                              \
-    if (getDerived().shouldTraverseTemplateArgumentsBeforeDecl()) {            \
-      TRY_TO(TraverseTemplateParameterListHelper(D->getTemplateParameters())); \
-      TRY_TO(TraverseDecl(D->getTemplatedDecl()));                             \
-    } else {                                                                   \
-      TRY_TO(TraverseDecl(D->getTemplatedDecl()));                             \
-      TRY_TO(TraverseTemplateParameterListHelper(D->getTemplateParameters())); \
-    }                                                                          \
+    TRY_TO(TraverseTemplateParameterListHelper(D->getTemplateParameters()));   \
+    TRY_TO(TraverseDecl(D->getTemplatedDecl()));                               \
                                                                                \
     /* By default, we do not traverse the instantiations of                    \
        class templates since they do not appear in the user code. The          \
Index: cfe/trunk/include/clang/AST/LexicallyOrderedRecursiveASTVisitor.h
===================================================================
--- cfe/trunk/include/clang/AST/LexicallyOrderedRecursiveASTVisitor.h
+++ cfe/trunk/include/clang/AST/LexicallyOrderedRecursiveASTVisitor.h
@@ -111,8 +111,6 @@
     return true;
   }
 
-  bool shouldTraverseTemplateArgumentsBeforeDecl() const { return true; }
-
   Stmt::child_range getStmtChildren(Stmt *S) { return S->children(); }
 
   SmallVector<Stmt *, 8> getStmtChildren(CXXOperatorCallExpr *CE) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D37662.114581.patch
Type: text/x-patch
Size: 2204 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170911/d604c294/attachment.bin>


More information about the cfe-commits mailing list