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

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


arphaman added inline comments.


================
Comment at: docs/LanguageExtensions.rst:2349
+attribute is supported by the pragma by referring to the
+:doc:`individual documentation for that attribute <AttributeReference>`.
----------------
efriedma wrote:
> I'm wondering if we can tweak the approach so that we don't have to separately define how this works for each attribute; for example, `#pragma clang attribute_function_declaration push(...)` would apply to each function declaration, `#pragma clang attribute_global_variable_declaration push(...)` would apply to each global variable declaration, etc.
I agree with this idea, I think it would be useful to have the ability to specify the target declarations. I do think it would be better to use the 'clang attribute' umbrella pragma, and maybe add an extra argument to the 'push', e.g.:

```
#pragma attribute push (annotate("functions-only"), applicable_to=function) // or maybe received_by=?
#pragma attribute push (annotate("struct+enum"), applicable_to=struct, applicable_to=enum)
```


Repository:
  rL LLVM

https://reviews.llvm.org/D30009





More information about the cfe-commits mailing list