[clang] Give better message for unsupported no_sanitize on globals
authorAlex Brachet <abrachet@google.com>
Thu, 1 Sep 2022 22:35:42 +0000 (22:35 +0000)
committerAlex Brachet <abrachet@google.com>
Thu, 1 Sep 2022 22:35:42 +0000 (22:35 +0000)
commitf6d6e33abc2e8657b04721841d15191b7c3ff3d1
tree99444c04051a5dfd7a4196649d82b2aa3a9d05bb
parentc911befaec494c52a63e3b957e28d449262656fb
[clang] Give better message for unsupported no_sanitize on globals

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".

Differential Revision: https://reviews.llvm.org/D133117
clang/docs/ReleaseNotes.rst
clang/include/clang/Basic/DiagnosticSemaKinds.td
clang/lib/Sema/SemaDeclAttr.cpp
clang/test/SemaCXX/attr-no-sanitize.cpp