[PATCH] D43750: Allow writing calling convention attributes on function types

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Feb 25 12:29:55 PST 2018


aaron.ballman created this revision.
aaron.ballman added a reviewer: rsmith.

Calling convention attributes notionally appertain to the function type -- they modify the mangling of the function, change the behavior of assignment operations, etc. However, they're not currently allowed to be written in the type position within a function declaration. This patch allows the calling convention attributes to be written in the type position as well as the declaration position. This also adds a new diagnostic to diagnose this as being incompatible with GCC despite the attribute being in the `gnu` namespace. I do not think this incompatibility is sufficient to warrant adding a `clang` namespace for the attributes, but that is another option available to us if there is concern over the incompatibility.

Eventually, I would like to extend this to other attributes that really should be type attributes, such as enable_if. The calling convention attributes just happen to be the lowest hanging fruit.


https://reviews.llvm.org/D43750

Files:
  include/clang/Basic/Attr.td
  include/clang/Basic/DiagnosticSemaKinds.td
  lib/Sema/SemaType.cpp
  test/SemaCXX/cxx11-gnu-attrs.cpp
  test/SemaCXX/type-attrs.cpp
  utils/TableGen/ClangAttrEmitter.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D43750.135843.patch
Type: text/x-patch
Size: 8694 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180225/f227aeb4/attachment.bin>


More information about the cfe-commits mailing list