[PATCH] D53700: Support _Clang as a scoped attribute identifier

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 25 07:22:13 PDT 2018


aaron.ballman created this revision.
aaron.ballman added reviewers: rsmith, echristo, dblaikie.
Herald added a subscriber: krytarowski.

Currently, we only accept `clang` as the scoped attribute identifier for double square bracket attributes provided by Clang, but this has the potential to conflict with user-defined macros. To help alleviate these concerns, this patch introduces the `_Clang` scoped attribute identifier as an alias for `clang`.

GCC elected to go with `__gnu__` for their protected name, but we cannot follow suit due to `__clang__` being a predefined macro that identifies the implementation.  I added a warning with a fixit on the off chance someone attempts to use `__clang__` as the scoped attribute identifier, but do not support the spelling fully (for instance, `__has_cpp_attribute` does not support `__clang__`).


https://reviews.llvm.org/D53700

Files:
  include/clang/Basic/DiagnosticParseKinds.td
  lib/Basic/Attributes.cpp
  lib/Parse/ParseDeclCXX.cpp
  lib/Sema/ParsedAttr.cpp
  test/FixIt/fixit-cxx11-attributes.cpp
  test/Parser/cxx0x-attributes.cpp
  test/Preprocessor/has_attribute.cpp
  test/SemaCXX/attr-optnone.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D53700.171087.patch
Type: text/x-patch
Size: 9021 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20181025/907029d7/attachment-0001.bin>


More information about the cfe-commits mailing list