<div dir="ltr">Sounds totally reasonable. I prefer '#pragma clang attribute push(...)' to the other one, since it will fit more easily into our pragma handler code.<div><br></div><div>The infrastructure for managing pragma stacks that apply attributes to decls should be in decent shape at this point after adding all the stack-based MS pragmas. If it isn't, we should refactor things more, since this is a pretty common pattern.</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Feb 13, 2017 at 4:24 PM, Alex L via cfe-dev <span dir="ltr"><<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi,<div><br></div><div>I would like to propose a new Clang pragma that would apply a specified attribute to some specific declarations in a source file. Initially the pragma would only work with annotation-like attributes that explicitly opt-in into allowing this pragma. This will ensure that this pragma can avoid conflicts with other pragmas that apply attributes like "#pragma clang optimize off", etc. The set of declarations that receive the attribute would be attribute-specific. </div><div><br></div><div>I would like to propose the following syntax:</div><div><br></div><div>    #pragma clang attribute push(annotate("important")) // or maybe push(__attribute__(annotate("<wbr>important")))?</div><div><br></div><div>    void foo(); // This function will now have the annotate("important") attribute.</div><div><br></div><div>    #pragma clang attribute pop</div><div><br></div><div>We would like to use this pragma to apply the new 'external_source_attribute' (<a href="https://reviews.llvm.org/D29819" rel="noreferrer" style="font-size:12.800000190734863px" target="_blank">https://reviews.llvm.org/D298<wbr>19</a>) to all of the declarations in an Objective-C header file that was auto-generated by the Swift compiler without adding additional attribute/macro to each declaration.</div><div><br></div><div>Do you have any thoughts / suggestions about this proposal?</div><div><br></div><div>Cheers,</div><div>Alex</div></div>
<br>______________________________<wbr>_________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@lists.llvm.org">cfe-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/cfe-dev</a><br>
<br></blockquote></div><br></div>