[PATCH] D30009: Add support for '#pragma clang attribute'

Alex Lorenz via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Feb 15 15:03:09 PST 2017


arphaman created this revision.

This patch adds support for the `#pragma clang attribute` directive that was proposed recently at http://lists.llvm.org/pipermail/cfe-dev/2017-February/052689.html.

Initially it supports the `annotate`, `require_constant_initialization` and `objc_subclassing_restricted` attribute (I added support for the last two to verify that only those declarations that are specified in the Attr.td subject list can receive the attribute). The attributes are parsed immediately and are applied individually to each relevant declaration. The attribute application errors aren't reported more than once. The `annotate` attribute, which doesn't have the subject list, is applied only to those declarations that can receive explicit GNU-style attributes.

Thanks


Repository:
  rL LLVM

https://reviews.llvm.org/D30009

Files:
  docs/LanguageExtensions.rst
  include/clang/Basic/Attr.td
  include/clang/Basic/DiagnosticParseKinds.td
  include/clang/Basic/DiagnosticSemaKinds.td
  include/clang/Basic/TokenKinds.def
  include/clang/Parse/Parser.h
  include/clang/Sema/AttributeList.h
  include/clang/Sema/Sema.h
  lib/Parse/ParsePragma.cpp
  lib/Parse/ParseStmt.cpp
  lib/Parse/Parser.cpp
  lib/Sema/AttributeList.cpp
  lib/Sema/SemaAttr.cpp
  lib/Sema/SemaDecl.cpp
  lib/Sema/SemaDeclCXX.cpp
  lib/Sema/SemaDeclObjC.cpp
  lib/Sema/SemaObjCProperty.cpp
  test/Parser/pragma-attribute.cpp
  test/Sema/pragma-attribute.c
  test/SemaCXX/pragma-attribute.cpp
  test/SemaObjC/pragma-attribute.m
  utils/TableGen/ClangAttrEmitter.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D30009.88612.patch
Type: text/x-patch
Size: 45146 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170215/31ecf779/attachment-0001.bin>


More information about the cfe-commits mailing list