This is an archive of the discontinued LLVM Phabricator instance.

[clang][pragma] Extend diagnostic pragmas to allow for only applying to the next line
AbandonedPublic

Authored by leonardchan on Jul 16 2020, 11:35 AM.

Details

Reviewers
phosek
Summary

This patch extends the #pragma clang diagnstic syntax to specify that a diagnostic affected by this pragma should only be applied to the following line. This is mainly a quality-of-life change that makes it simpler for ignoring or changing warnings for only 1 line.

The syntax is

#pragma clang diagnostic ignored line "-Wsign-conversion"
signed_x = unisgned_y;  // No warning

and is functionally equivalent to

#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wsign-conversion"
signed_x = unsigned_y;  // No warning
#pragma clang diagnostic pop

Diff Detail

Event Timeline

leonardchan created this revision.Jul 16 2020, 11:35 AM
leonardchan abandoned this revision.Jul 22 2020, 11:48 AM