[llvm-commits] [patch] Enable unnamed_addr in declarations again
Rafael Ávila de Espíndola
rafael.espindola at gmail.com
Fri Jan 14 17:12:50 PST 2011
I was convinced that we should allow unnamed_addr in declarations. This
patch does it. I am just not entirely convinced what the behavior should
be when resolving a declaration to a definition.
This patch implements what I understood is sabre's preference:
bool HasUnnamedAddr = SGV->hasUnnamedAddr();
if (DGV && (!LinkFromSrc || DGV->isDeclaration()))
HasUnnamedAddr = HasUnnamedAddr && DGV->hasUnnamedAddr();
i.e, set drop the unnamed_addr unless both have it except for weak defs,
where we keep the strong def.
I find
bool HasUnnamedAddr = SGV->hasUnnamedAddr();
if (DGV && !LinkFromSrc)
HasUnnamedAddr = HasUnnamedAddr && DGV->hasUnnamedAddr();
to be a bit more natural (in the included testcase, this changes the
result of @d).
Cheers,
Rafael
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: unnamed.patch
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20110114/5f3f1661/attachment.ksh>
More information about the llvm-commits
mailing list