[PATCH] D121283: [Clang] Support multiple attributes in a single pragma

Egor Zhdan via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Mar 9 04:46:44 PST 2022


egorzhdan created this revision.
egorzhdan added a reviewer: arphaman.
Herald added a subscriber: jdoerfert.
Herald added a project: All.
egorzhdan requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

This adds support for multiple attributes in `#pragma clang attribute push`, for example:

  #pragma clang attribute push (__attribute__((disable_sanitizer_instrumentation)) __attribute__((section("S"))), apply_to=variable(is_global))

or

  #pragma clang attribute push ([[clang::disable_tail_calls, noreturn]], apply_to = function)

Related attributes can now be applied with a single pragma, which makes it harder for developers to make an accidental error later when editing the code.

rdar://78269653


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D121283

Files:
  clang/include/clang/Basic/AttrSubjectMatchRules.h
  clang/include/clang/Basic/DiagnosticParseKinds.td
  clang/lib/Parse/ParseDecl.cpp
  clang/lib/Parse/ParsePragma.cpp
  clang/test/AST/pragma-multiple-attributes-declspec.cpp
  clang/test/AST/pragma-multiple-attributes.cpp
  clang/test/FixIt/fixit-pragma-attribute.c
  clang/test/FixIt/fixit-pragma-attribute.cpp
  clang/test/Parser/pragma-attribute-declspec.cpp
  clang/test/Parser/pragma-attribute.cpp
  clang/test/Parser/pragma-multiple-attributes.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D121283.414067.patch
Type: text/x-patch
Size: 24187 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220309/36a05c2c/attachment-0001.bin>


More information about the cfe-commits mailing list