[cfe-dev] Where do attributes get merged?
Aaron Ballman
aaron at aaronballman.com
Wed Dec 10 05:49:40 PST 2014
Yes, you're looking for Sema::mergeDeclAttributes. You're also correct
that the current behavior only works when the attributes are on the
same declaration.
However, from memory, I don't think that situation of yours should
result in well-formed code. IIRC, the definition must not attempt to
declare new attributes (aside from some keyword-like ones) that do not
also appear on the declaration.
~Aaron
On Wed, Dec 10, 2014 at 12:13 AM, David Majnemer
<david.majnemer at gmail.com> wrote:
> IIRC, attribute merging largely happens in mergeDeclAttribute:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?revision=222906&view=markup#l2124
>
> On Tue, Dec 9, 2014 at 6:27 PM, Robinson, Paul
> <Paul_Robinson at playstation.sony.com> wrote:
>>
>> I'm starting to look into Aaron Ballman's request to diagnose the cases
>> where the OptimizeNone attribute "wins" over things like MinSize. This
>> is leading me through a maze of twisty little passages all different.
>>
>> One case that came up in my experiments is when you have (say)
>> always_inline
>> on a function declaration, and optnone on the function's definition. The
>> existing detection logic seems to work only when the conflicting
>> attributes
>> are on the same declaration. Seems like there would have to be some place
>> where attributes from the two declarations would be mashed together, but
>> I'm
>> not finding it; could somebody please point me in the right direction?
>> Thanks,
>> --paulr
>>
>>
>> _______________________________________________
>> cfe-dev mailing list
>> cfe-dev at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>
>
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>
More information about the cfe-dev
mailing list