This is an archive of the discontinued LLVM Phabricator instance.

[AST] Add a print method to Introspection LocationCall
ClosedPublic

Authored by njames93 on Apr 13 2021, 4:13 PM.

Details

Summary

Add a print method that takes a raw_ostream.
Change LocationCallFormatterCpp::format to call that method.

Diff Detail

Event Timeline

njames93 requested review of this revision.Apr 13 2021, 4:13 PM
njames93 created this revision.
Herald added a project: Restricted Project. · View Herald TranscriptApr 13 2021, 4:13 PM
Herald added a subscriber: cfe-commits. · View Herald Transcript
steveire requested changes to this revision.Apr 14 2021, 3:54 PM
steveire added inline comments.
clang/lib/Tooling/NodeIntrospection.cpp
26

The reason for the LocationCallFormatterCpp is that we can write a LocationCallFormatterPython for example which skips over casts (not needed) and always uses ., never ->. I can add a unit test for that once we do chaining and casting for typelocs (coming soon).

We shouldn't encode c++-ness into the LocationCall. I think the only remaining change in this MR is the ArrayRef change, which I think you can just go ahead and commit in an NFC commit.

This revision now requires changes to proceed.Apr 14 2021, 3:54 PM
njames93 updated this revision to Diff 337724.Apr 15 2021, 5:12 AM

Tweak implementaion to make the print a static method of FormatterCpp.

steveire accepted this revision.Apr 15 2021, 6:32 AM

Thanks!

This revision is now accepted and ready to land.Apr 15 2021, 6:32 AM
This revision was automatically updated to reflect the committed changes.