This is an archive of the discontinued LLVM Phabricator instance.

[clang] Add a raw_ostream operator<< overload for QualType
ClosedPublic

Authored by njames93 on Apr 18 2022, 3:04 AM.

Details

Summary

Under the hood this prints the same as QualType::getAsString() but cuts out the middle-man when that string is sent to another raw_ostream.

Also cleaned up all the call sites where this occurs.

Diff Detail

Event Timeline

njames93 created this revision.Apr 18 2022, 3:04 AM
Herald added a project: Restricted Project. · View Herald TranscriptApr 18 2022, 3:04 AM
Herald added a subscriber: martong. · View Herald Transcript
njames93 requested review of this revision.Apr 18 2022, 3:04 AM
Herald added a project: Restricted Project. · View Herald TranscriptApr 18 2022, 3:04 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript
aaron.ballman accepted this revision.Apr 19 2022, 10:50 AM

Thanks for this! LGTM with some small nits.

clang/include/clang/AST/Type.h
1319

Cleaning up the declaration a bit, but the important change is not making QT a const ref (the type is small and meant to be passed by value cheaply).

clang/lib/AST/TypePrinter.cpp
2313

Please spell out the type.

This revision is now accepted and ready to land.Apr 19 2022, 10:50 AM
njames93 updated this revision to Diff 423955.Apr 20 2022, 10:30 AM

Address nits.

njames93 marked 2 inline comments as done.Apr 20 2022, 10:33 AM
njames93 added inline comments.
clang/include/clang/AST/Type.h
1319

I knew it needed cleaning, Just had issues with the declaration not matching the definition so added all qualifiers.

This revision was automatically updated to reflect the committed changes.
njames93 marked an inline comment as done.