This is an archive of the discontinued LLVM Phabricator instance.

[clang] Give better message for unsupported no_sanitize on globals
ClosedPublic

Authored by abrachet on Sep 1 2022, 8:33 AM.

Details

Summary

Previously if you specified no_sanitize("known_sanitizer") on a global you
would yield a misleading error "'no_sanitize' attribute only applies to
functions and methods", but no_sanitize("unknown") would simply be a warning,
"unknown sanitizer 'unknown' ignored". This changes the former to a warning
"'no_sanitize' attribute argument not supported for globals: known_sanitizer".

Diff Detail

Event Timeline

abrachet created this revision.Sep 1 2022, 8:33 AM
Herald added a project: Restricted Project. · View Herald TranscriptSep 1 2022, 8:33 AM
hctim accepted this revision.Sep 1 2022, 11:11 AM

Thanks!

This revision is now accepted and ready to land.Sep 1 2022, 11:11 AM
aaron.ballman accepted this revision.Sep 1 2022, 11:33 AM

LGTM aside from a requested change in diagnostic wording (no need for additional review), though please also add a release note when landing so people know about the improvement here.

clang/include/clang/Basic/DiagnosticSemaKinds.td
4056

A slightly different color of bikeshed that might be easier on the eyes.

Herald added a project: Restricted Project. · View Herald TranscriptSep 1 2022, 3:36 PM
Herald added a subscriber: cfe-commits. · View Herald Transcript
abrachet marked an inline comment as done.Sep 1 2022, 3:37 PM

LGTM aside from a requested change in diagnostic wording (no need for additional review), though please also add a release note when landing so people know about the improvement here.

Sure, this and the inline have been addressed in the commit