diff options
author | Eduardo Caldas <ecaldas@google.com> | 2020-08-05 13:55:17 +0000 |
---|---|---|
committer | Eduardo Caldas <ecaldas@google.com> | 2020-08-25 06:34:40 +0000 |
commit | c655d8081570336dda109502ed1e7a2eff1b26e2 (patch) | |
tree | cdc67ad6a7f1744d64edbe4a201d304c7f659454 /clang/lib/Tooling/Syntax/BuildTree.cpp | |
parent | 2501e911a5a174fc1a07a2a1ac687a2bf0f05ef3 (diff) | |
download | llvm-c655d8081570336dda109502ed1e7a2eff1b26e2.zip llvm-c655d8081570336dda109502ed1e7a2eff1b26e2.tar.gz llvm-c655d8081570336dda109502ed1e7a2eff1b26e2.tar.bz2 |
[SyntaxTree] Extend the syntax tree dump to also cover `NodeRole`
We should see `NodeRole` information in the dump because that exposes how the
accessors will behave.
Functional changes in the dump:
* Surround Leaf tokens with `'`
* Append `Node` dumps with `NodeRole` information, except for unknown roles
* Append marks to `Node` dumps, instead of prepending
Non-functional changes:
* `::dumpTokens(llvm::raw_ostream, ArrayRef<syntax::Token>, const
SourceManager &SM)` always received as parameter a `syntax::Token *`
pointing to `Leaf::token()`. Changed the function to
`dumpLeaf(llvm::raw_ostream, syntax::Leaf *, const SourceManager&)`
* `dumpTree` acted on a Node, rename to `dumpNode`
Differential Revision: https://reviews.llvm.org/D85330
Diffstat (limited to 'clang/lib/Tooling/Syntax/BuildTree.cpp')
-rw-r--r-- | clang/lib/Tooling/Syntax/BuildTree.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/clang/lib/Tooling/Syntax/BuildTree.cpp b/clang/lib/Tooling/Syntax/BuildTree.cpp index 3ab52ce..f027a60 100644 --- a/clang/lib/Tooling/Syntax/BuildTree.cpp +++ b/clang/lib/Tooling/Syntax/BuildTree.cpp @@ -546,7 +546,7 @@ private: R += std::string( formatv("- '{0}' covers '{1}'+{2} tokens\n", It->second->kind(), It->first->text(A.sourceManager()), CoveredTokens)); - R += It->second->dump(A); + R += It->second->dump(A.sourceManager()); } return R; } |