[PATCH] D53621: Support for groups of attributes in #pragma clang attribute
Erik Pilkington via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Oct 23 16:02:16 PDT 2018
erik.pilkington created this revision.
erik.pilkington added reviewers: aaron.ballman, arphaman.
Herald added a subscriber: dexonsmith.
This patch allows pushing an empty `#pragma clang attribute push`, then adding multiple attributes to it, then popping them all with `#pragma clang attribute pop`, just like `#pragma clang diagnostic`. We still support the current way of adding these, `#pragma clang attribute push(__attribute__((...)))`, by treating it like a combined push/attribute. This is needed to create macros that behave like:
DO_SOMETHING_BEGIN(attr1, attr2, attr3)
// ...
DO_SOMETHING_END
Which can be called with a variable number of arguments. One possible alternative would be to allow multiple attributes to be specified in the combined push operation, but I chose this method to be more consistent with `#pragma clang diagnostic`.
Fixes rdar://45496947.
Thanks for taking a look!
Erik
Repository:
rC Clang
https://reviews.llvm.org/D53621
Files:
clang/include/clang/Basic/DiagnosticParseKinds.td
clang/include/clang/Basic/DiagnosticSemaKinds.td
clang/include/clang/Sema/Sema.h
clang/lib/Parse/ParsePragma.cpp
clang/lib/Sema/SemaAttr.cpp
clang/test/Parser/pragma-attribute.cpp
clang/test/Sema/pragma-attribute.c
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D53621.170770.patch
Type: text/x-patch
Size: 13993 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20181023/c1c65f5c/attachment-0001.bin>
More information about the cfe-commits
mailing list