[clang] Add support for __attribute__((guard(nocf)))
authorAlvin Wong <alvin@alvinhc.com>
Tue, 23 Aug 2022 20:08:05 +0000 (23:08 +0300)
committerMartin Storsjö <martin@martin.st>
Tue, 23 Aug 2022 20:39:38 +0000 (23:39 +0300)
commit94778692ad25456c9042caae96c40a7c066b6249
tree83bc426d75a651d2439f3c6510779480324f6131
parentb105656207143001b2daa8ce4d2cbc09bcc9cf91
[clang] Add support for __attribute__((guard(nocf)))

To support using Control Flow Guard with mingw-w64, Clang needs to
accept `__declspec(guard(nocf))` also for the GNU target. Since mingw
has `#define __declspec(a) __attribute__((a))` as built-in, the simplest
solution is to accept `__attribute__((guard(nocf)))` to be compatible with
MSVC and Clang's msvc target.

As a side effect, this also adds `[[clang::guard(nocf)]]` for C++.

Reviewed By: aaron.ballman

Differential Revision: https://reviews.llvm.org/D132302
clang/docs/ReleaseNotes.rst
clang/include/clang/Basic/Attr.td
clang/test/CodeGen/guard_nocf.c
clang/test/CodeGenCXX/guard_nocf.cpp
clang/test/Misc/pragma-attribute-supported-attributes-list.test
clang/test/Sema/attr-guard_nocf.c