[PATCH] D37003: [clang-diff] Support templates

Alex Lorenz via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 24 06:46:15 PDT 2017


arphaman added inline comments.


================
Comment at: lib/Tooling/ASTDiff/ASTDiff.cpp:299
   }
+// We want nodes to be in the same order as in the source code.
+// So we traverse template parameters before the remainder of the declaration.
----------------
Interesting, I didn't know that this iteration happened out-of-order. My https://reviews.llvm.org/D35012 patch (I'll commit it right now) has a RecursiveASTVisitor subclass that tries to traverse the tree in the source order, I think you should move this code:

```
  DEF_TRAVERSE_TMPL_DECL_(Class)
  DEF_TRAVERSE_TMPL_DECL_(Var)
  DEF_TRAVERSE_TMPL_DECL_(Function)
```

to `LexicallyOrderedRecursiveASTVisitor` subclass instead and change your visitor to derive from `LexicallyOrderedRecursiveASTVisitor`. You can probably repurpose https://reviews.llvm.org/D36998 and have both the visibility change and the move to `LexicallyOrderedRecursiveASTVisitor` in that patch.


https://reviews.llvm.org/D37003





More information about the cfe-commits mailing list