This is an archive of the discontinued LLVM Phabricator instance.

[Driver][Diagnostics] Make 'show option names' default for driver warnings
ClosedPublic

Authored by bruno on Sep 13 2016, 10:54 AM.

Details

Summary

Currently, driver level warnings do not show option names (e.g. warning: complain about foo [-Woption-name]) in a diagnostic unless -fdiagnostics-show-option is explictly specified. OTOH, the driver by default turn this option on for CC1. Change the logic to show option names by default in the driver as well.

Diff Detail

Event Timeline

bruno updated this revision to Diff 71207.Sep 13 2016, 10:54 AM
bruno retitled this revision from to [Driver][Diagnostics] Make 'show option names' default for driver warnings.
bruno updated this object.
bruno added a reviewer: rsmith.
bruno added a subscriber: cfe-commits.
vsk added inline comments.Oct 10 2016, 2:54 PM
lib/Frontend/CompilerInvocation.cpp
974

Does it make sense to use: hasFlag (OptSpecifier Pos, OptSpecifier Neg, bool Default=DefaultShowOpt) ? This might take care of an edge case where both show_option and no_show_option are specified -- the last flag passed should win out.

test/Driver/show-option-names.c
5

Can you split this into two checks? One to check that the warning appear, and another to check that the option isn't printed.

bruno updated this revision to Diff 74185.Oct 10 2016, 4:44 PM

Update after Vedant's review!

vsk accepted this revision.Oct 10 2016, 4:49 PM
vsk edited edge metadata.

Lgtm, with one potential nit.

test/Driver/show-option-names.c
5

Argh, I suppose there's no "CHECK-SAME-NOT" functionality in FileCheck. If you want to shave off a compiler invocation, maybe you could write:

CHECK: ... {{$}}

This revision is now accepted and ready to land.Oct 10 2016, 4:49 PM
bruno closed this revision.Oct 10 2016, 5:13 PM

Committed r283827

test/Driver/show-option-names.c
5

The "-NOT" functionality is there, but doesn't help in this case. The {{$}} worked well enough though! Thanks