[LLVMdev] [RFC] Overhauling Attributes

Bill Wendling wendling at apple.com
Wed Sep 19 16:27:38 PDT 2012


On Sep 19, 2012, at 4:09 PM, Chandler Carruth <chandlerc at google.com> wrote:

> I love it in principle. As you get closer to finalizing the syntax, etc. I might have some more detailed comments, but nothing really substantive.
> 
Yeah. I have a notion of what I'd like the syntax to look like, but that's not what this proposal is for. This is basically a "heads up!" that I'm about to change the Attributes class.

> Minor API comment as that seems more immediate:
> 
> On Wed, Sep 19, 2012 at 3:25 PM, Bill Wendling <wendling at apple.com> wrote:
> An example syntax could be:
> 
> // Building an Attribute
> 
> Attributes A;
> A.addAlignAttr(4)
>  .addNoUnwindAttr()
>  .addStackProtectorAttr()
>  .addUnwindTableAttr()
>  .addReadNoneAttr();
> 
> Personally, I would prefer to make the Attributes class be immutable, and the building happen in a helper. One possible interface would end up looking like:
> 
> Attributes Base = ...;
> 
> Attributes A = Attributes::Builder(Base).addNoUnwind()
>                                         .addStackProtector()
>                                         .addAlign(4);
> 
>  
I would like that too. Hmm...This has potential. Though I'll need to see how it plays out in practice. A lot of uses look like they assume a mutable object...

-bw




More information about the llvm-dev mailing list