This is an archive of the discontinued LLVM Phabricator instance.

Sema: do not warn about unused const vars if main file is a header
ClosedPublic

Authored by erikjv on Oct 26 2016, 7:52 AM.

Details

Reviewers
bkramer
Summary

If we pass a header to libclang, e.g. because it's open in an editor in
an IDE, warnings about unused const vars are not useful: other files
that include the header might use those constants. So when -x *-header
is passed as command-line option, suppress this warning.

Diff Detail

Event Timeline

erikjv updated this revision to Diff 75891.Oct 26 2016, 7:52 AM
erikjv retitled this revision from to Sema: do not warn about unused const vars if main file is a header.
erikjv updated this object.
erikjv added a reviewer: bkramer.
erikjv added a subscriber: cfe-commits.
bkramer accepted this revision.Oct 27 2016, 6:02 AM
bkramer edited edge metadata.

This makes sense. While variable definitions in a header are weird, the warning that they're unused isn't adding any value.

This revision is now accepted and ready to land.Oct 27 2016, 6:02 AM
bkramer added inline comments.Oct 27 2016, 6:05 AM
lib/Sema/Sema.cpp
870

Doesn't look clang-formatted.

erikjv closed this revision.Oct 28 2016, 6:32 AM

Committed as r285386.