This is an archive of the discontinued LLVM Phabricator instance.

[SyntaxTree] Proposition of new tree dump
AbandonedPublic

Authored by eduucaldas on Aug 5 2020, 8:13 AM.

Details

Reviewers
gribozavr2
Summary

Some key choices to highlight:

  • Surround Tokens with '
  • Do not print UnknownRole, to reduce noise
  • Surround Roles with <, to clarify the difference in meaning

Diff Detail

Event Timeline

eduucaldas created this revision.Aug 5 2020, 8:13 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 5 2020, 8:13 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript
eduucaldas requested review of this revision.Aug 5 2020, 8:13 AM
eduucaldas edited the summary of this revision. (Show Details)

I'd suggest to drop the <> quotes (because the AST dump does not add quotes unless it is printing a multi-word thing, and because <> don't exactly scream "role" helping to read the output).

I'd also suggest to replace multiple spaces before <> with a single space.

Otherwise, looks great!

Answering comments

Reflect comments

eduucaldas added inline comments.Aug 6 2020, 12:44 AM
clang/unittests/Tooling/Syntax/TreeTest.cpp
3381

Some points to make a decision.
What should be the order of these extra information?
I like the order now, Most frequent in the left.

More decriptive markers?
We could choose to have more descriptive markers
I -> unmodifieable
M-> not backed by source code / synthesized

Ambiguity.
Since we choose to not dump a role for NodeRole::Unknown we might have some ambiguity between NodeRoles and markers. We can avoid that by surrounding markers, or making them lower-case. or even by just leaving one character markers

eduucaldas abandoned this revision.Aug 21 2020, 5:21 AM