This is an archive of the discontinued LLVM Phabricator instance.

A slightly more concise AST dump :)
ClosedPublic

Authored by merrymeerkat on Jan 26 2023, 7:56 AM.

Details

Summary

If the modifiedType and the minimally desugared type of an AttributedType are the same, then we do not need to show both in an AST dump.

Here, we change VisitAttributedType to only visit the modifiedType when it is different from the equivalentType (the minimally desugared type), because the latter is already visited by default.

Diff Detail

Event Timeline

merrymeerkat created this revision.Jan 26 2023, 7:56 AM
Herald added a project: Restricted Project. · View Herald TranscriptJan 26 2023, 7:56 AM
merrymeerkat requested review of this revision.Jan 26 2023, 7:56 AM
Herald added a project: Restricted Project. · View Herald TranscriptJan 26 2023, 7:56 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript
merrymeerkat retitled this revision from A more concise AST dump If the modifiedType and the minimally desugared type of an AttributedType are the same, then we do not need to visit both (or show both in an AST dump). Here, we change VisitAttributedType to only visit the modifiedType... to A more concise AST dump.Jan 26 2023, 7:59 AM
merrymeerkat edited the summary of this revision. (Show Details)
merrymeerkat added a reviewer: sammccall.
merrymeerkat retitled this revision from A more concise AST dump to A slightly more concise AST dump :).
sammccall accepted this revision.Jan 26 2023, 9:53 AM
sammccall added inline comments.
clang/test/AST/ast-dump-attr-type.cpp
13

Can you add a second example where the attribute is not mere sugar, showing that both types get printed?

The example from the AttributedType doc is vector_size, which would work

This revision is now accepted and ready to land.Jan 26 2023, 9:53 AM
gribozavr2 added inline comments.
clang/test/AST/ast-dump-attr-type.cpp
13

Please replace the exact pointer value with a regex.

sammccall added inline comments.Jan 26 2023, 3:58 PM
clang/test/AST/ast-dump-attr-type.cpp
13

Oops, yes. In fact just CHECK-NOT: PointerType seems like enough

Addressing review comments (improve tests)

merrymeerkat marked 3 inline comments as done.Jan 31 2023, 3:56 AM

thank you @sammccall @gribozavr2 for spotting these issues!

sammccall accepted this revision.Jan 31 2023, 6:21 AM
This revision was landed with ongoing or failed builds.Feb 10 2023, 11:11 AM
This revision was automatically updated to reflect the committed changes.