[PATCH] Diagnose 'optnone' versus conflicting attrs on another decl

Robinson, Paul Paul_Robinson at playstation.sony.com
Thu Dec 11 16:27:00 PST 2014


Diagnose when attribute 'optnone' conflicts with attributes on a
different declaration.

I modeled this on how dllimport/dllexport are handled; specifically,
I made 'optnone' continue to "win" over 'always_inline' and 'minsize'.
This preserves the previous "winner" behavior but adds the diagnostics
that were requested.

I have two questions about all this.

First, the diagnostics point to the attribute being ignored, but not
to the attribute that caused it to be ignored.  Is that okay?  This
would be a problem for dllimport/dllexport as well as the new cases.

Second, now that there are 5 similar cases (dllimport v. dllexport,
plus optnone v. always_inline/minsize) it seems like there could be
an opportunity to refactor some of that diagnostic checking into a
templated helper function, along the lines of mergeVisibilityAttr.
Should I pursue that? (Not clear it's much of a win... but maybe.)

Thanks,
--paulr

-------------- next part --------------
A non-text attachment was scrubbed...
Name: optnone-part3.diff
Type: application/octet-stream
Size: 7230 bytes
Desc: optnone-part3.diff
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20141212/1b2cdfd2/attachment.obj>


More information about the cfe-commits mailing list