Split the output streaming from the traversal to other AST nodes.
Details
Diff Detail
- Repository
- rL LLVM
Event Timeline
include/clang/AST/TemplateArgumentVisitor.h | ||
---|---|---|
23 ↗ | (On Diff #180947) | std::add_lvalue_reference<> already does this, so do we really need this? |
24 ↗ | (On Diff #180947) | I'm guessing we can't use std::add_lvalue_reference<std::add_const<>> for the same reasons we couldn't use it for pointers, but then make_const_ref should live in STLExtras.h and not here (it's generally useful). |
27–28 ↗ | (On Diff #180947) | s/class/typename to be self-consistent |
55 ↗ | (On Diff #180947) | Might be worth it to replace these with a macro, sort of like how DISPATCH is used above. |
include/clang/AST/TextNodeDumper.h | ||
156 ↗ | (On Diff #180947) | label -> Label and I think we should use a StringRef for the type. |
lib/AST/ASTDumper.cpp | ||
449–450 ↗ | (On Diff #180947) | llvm::for_each(TA.pack_elements(), ...); (or a range-based for loop) |
lib/AST/TextNodeDumper.cpp | ||
68 ↗ | (On Diff #180947) | label -> Label |
73 ↗ | (On Diff #180947) | Elide braces |
lib/AST/ASTDumper.cpp | ||
---|---|---|
449–450 ↗ | (On Diff #180947) | I'm just moving the code as it is in its origin location. You could rewrite it separately if you wish. |
lib/AST/ASTDumper.cpp | ||
---|---|---|
449–450 ↗ | (On Diff #180947) | I realize that. You're updating existing code, which is a perfectly appropriate time for NFC improvements to it -- we make these kinds of requests frequently because it's the time at which we notice these minor deficiencies. |
Aside from nits that aren't complete yet, LGTM.
include/clang/AST/TemplateArgumentVisitor.h | ||
---|---|---|
24 ↗ | (On Diff #181395) | Missed a typename in there. |
Out of interest, what's the motivation for this? It seems to add way more code than it removes, so there must be some other advantage, but the patch description doesn't say.
The reason for this is to split the output streaming from the traversal to other AST nodes.
This is a step as part of a larger refactoring with the aim of a class extracted from ASTDumper which does traversal but no streaming. That way, we can dump other output formats and do other things with the traversal.
include/clang/AST/TemplateArgumentVisitor.h | ||
---|---|---|
24 ↗ | (On Diff #181395) | If you're talking about the TTP, class must be used until C++17. See https://en.cppreference.com/w/cpp/language/template_parameters |