This is an archive of the discontinued LLVM Phabricator instance.

[ASTDump] Add a flag indicating whether a CXXThisExpr is implicit
ClosedPublic

Authored by riccibruno on Feb 3 2019, 6:11 AM.

Diff Detail

Repository
rC Clang

Event Timeline

riccibruno created this revision.Feb 3 2019, 6:11 AM
riccibruno edited the summary of this revision. (Show Details)Feb 3 2019, 9:39 AM

I have no objection to this, but I wonder whether all state accessible from all nodes should be part of the AST dump. Where do you think the line is? Is there anything else missing currently from other nodes?

steveire accepted this revision.Feb 3 2019, 9:50 AM
This revision is now accepted and ready to land.Feb 3 2019, 9:50 AM

I have no objection to this, but I wonder whether all state accessible from all nodes should be part of the AST dump. Where do you think the line is? Is there anything else missing currently from other nodes?

I think that this depends on the specific node. It seem that there should be a distinction between state that is "generally useful" (whatever that means) to the average clang developer/user and internal state which is there for a narrow specific purpose. For example (looking at the statement/expression hierarchy):

NullStmt has a flag HasLeadingEmptyMacro => probably not useful to expose.
SwitchStmt has a flag AllEnumCasesCovered which is used for diagnostics => probably not useful to expose.

Additionally some flags are there only to remember which trailing objects are there. I don't think that exposing these is useful (as long as the AST dump output is unambiguous).

Though it is a subjective distinction and in the end if someone need a flag it is going to be added I guess.

Thanks for the review !

This revision was automatically updated to reflect the committed changes.

Though it is a subjective distinction and in the end if someone need a flag it is going to be added I guess.

That's the crux of how we've decided what information to expose in the past. Some folks will expose the information when adding it to an AST node, but not always. More often what happens is that someone finds they need that information to help make an AST dump more readable, then the information gets exposed at that point because there's a use case for it.

Though it is a subjective distinction and in the end if someone need a flag it is going to be added I guess.

That's the crux of how we've decided what information to expose in the past. Some folks will expose the information when adding it to an AST node, but not always. More often what happens is that someone finds they need that information to help make an AST dump more readable, then the information gets exposed at that point because there's a use case for it.

Which is exactly why I added this flag. From what I understand the AST dump is mostly a tool used by people hacking on clang, and so this make sense.