This is an archive of the discontinued LLVM Phabricator instance.

[diagtool] Change default tree behavior to print only flags
ClosedPublic

Authored by JDevlieghere on Sep 1 2017, 12:29 PM.

Details

Summary

This patch changes the default behavior of diagtool tree to only
display warning flags and not the internal warnings flags. The latter is
an implementation detail of the compiler and usually not what the users
wants.

Furthermore, flags that are enabled by default are now also printed in
green. Originally, this was only the case for the diagnostic names.

Diff Detail

Repository
rL LLVM

Event Timeline

JDevlieghere created this revision.Sep 1 2017, 12:29 PM
JDevlieghere edited the summary of this revision. (Show Details)Sep 1 2017, 12:29 PM
aprantl added a subscriber: aprantl.Sep 1 2017, 2:29 PM

Can this be tested?

tools/diagtool/ListWarningFlags.cpp
36 ↗(On Diff #113572)

range-based for / auto?

38 ↗(On Diff #113572)

The LLVM style wants variables to begin with an uppercase letter.

JDevlieghere retitled this revision from [diagtool] Add list-warning-flags to [diagtool] Change default tree behavior to print only flags.Sep 4 2017, 2:23 AM
JDevlieghere edited the summary of this revision. (Show Details)

Thanks for the review Adrian!

I somehow completely overlooked the existing --flags-only option in diagtool tree. Obviously it makes much more sense to implement printing flags here and make it the default behavior. I've also added some code to print the flags with the appropriate color, i.e. defaults are printed in green while the others remain printed in yellow as before.

I've updated the diff to reflect this and added a test case.

The diagtool tests should go to test/Misc, and there's an existing diagtool tree test there that has to be updated as well.

Thanks Alex!

arphaman accepted this revision.Sep 4 2017, 9:58 AM

LGTM.

Please precommit the auto loop modernization though. You might want to use llvm::make_range for for-ranged loops as well.

This revision is now accepted and ready to land.Sep 4 2017, 9:58 AM
This revision was automatically updated to reflect the committed changes.