[clang][pp] Handle attributes defined by plugin in __has_attribute
authorAnders Waldenborg <anders@0x63.nu>
Sun, 12 Feb 2023 21:12:08 +0000 (22:12 +0100)
committerAnders Waldenborg <anders@0x63.nu>
Mon, 13 Mar 2023 15:47:51 +0000 (16:47 +0100)
commit1285a495d5886b99f8d193c90b258a56f89c8937
tree23297183a3354501a372ced5f63169e24eb502f6
parent8629343a8b6c26f15f02de2fdd8db440eba71937
[clang][pp] Handle attributes defined by plugin in __has_attribute

When using attributes by plugins (both in clang and clang-tidy) the
preprocessor functions `__has_attribute`, `__has_c_attribute`,
`__has_cpp_attribute` still returned 0.

That problem is fixed by having the "hasAttribute" function also check
if any of the plugins provide that attribute.

This also adds C2x spelling to the example plugin for attributes so that
`__has_c_attribute` can be tested.

Differential Revision: https://reviews.llvm.org/D144405
clang/docs/ReleaseNotes.rst
clang/examples/Attribute/Attribute.cpp
clang/lib/Basic/Attributes.cpp
clang/test/Frontend/plugin-attribute-pp.cpp [new file with mode: 0644]