[PATCH] D63845: [WIP] Create a clang attribute that lets users specify LLVM attributes

Roman Lebedev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jun 28 01:19:54 PDT 2019


lebedev.ri added a comment.

In D63845#1561793 <https://reviews.llvm.org/D63845#1561793>, @jdoerfert wrote:

> In D63845#1560605 <https://reviews.llvm.org/D63845#1560605>, @aaron.ballman wrote:
>
> > In D63845#1559995 <https://reviews.llvm.org/D63845#1559995>, @lebedev.ri wrote:
> >
> > > What's the target use-case here? What can't be solved with normal attributes?
> >
>
>
> With "normal" you mean something like `__attribute__((noescape))`? We don't have them for all attributes, I doubt we want to but I might be wrong.


That is precisely the question.
What is the motivation for exposing such LLVM-specific low-level unstable implementation detail?

>>> I wonder if this should go to cfe+llvm -dev lists first, it's kinda intrusive.
> 
> This is not a review to get this in. Before anything happens an RFC will be issued and discussed. We'll use this to experiment and other people can do so as well.



>>> I also wonder if all these should cause a clang diagnostic, at least under `-Wall`.
> 
> What do you mean?

These are very much a generally-incompatible, very fragile, extensions.
They will not work on any other compiler, and will likely not work
on a different version of clang. It is not okay not to diagnose such cases.

>>> How is versioning expected to be handled? New attribute vs old clang, and vice versa.
> 
> Unknown attributes are not necessarily a problem, they should compile fine ignoring the attribute, or am I wrong?

I don't know, that's why i'm asking.

>> Also, we already have the `annotate` attribute for passing information through to LLVM. Why do we need four different ways to do this?
> 
> I didn't know that one, e.g., it is not in https://clang.llvm.org/docs/AttributeReference.html. I glanced it in clang and it did not seem to do the same thing, thus allowing to generate LLVM-IR attributes at the different positions. If it is, we should use it instead.




Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D63845/new/

https://reviews.llvm.org/D63845





More information about the cfe-commits mailing list