This is an archive of the discontinued LLVM Phabricator instance.

Don't crash when a selectany symbol would get common linkage
ClosedPublic

Authored by thakis on Apr 15 2015, 3:20 PM.

Details

Reviewers
rnk
Summary

Don't crash when a selectany symbol would get common linkage

Things can't both be in comdats and have common linkage, so never give things in comdats common linkage. Common linkage is only used in .c files, and the only thing that can trigger a comdat in c is selectany from what I can tell. Fixes PR23243.

Also address an over-the-shoulder review comment from rnk by moving the hasAttr<SelectAnyAttr>() in Decl.cpp around a bit. It only makes a minor difference for selectany on global variables, so it goes well with the rest of this patch.

Diff Detail

Event Timeline

thakis updated this revision to Diff 23805.Apr 15 2015, 3:20 PM
thakis retitled this revision from to Don't crash when a selectany symbol would get common linkage.
thakis updated this object.
thakis edited the test plan for this revision. (Show Details)
thakis added a reviewer: rnk.
thakis added a subscriber: Unknown Object (MLST).
rnk accepted this revision.Apr 15 2015, 3:50 PM
rnk edited edge metadata.

lgtm

I think the only other way to get shouldBeInCOMDAT to return true is with static data members of class templates, but those never get common linkage anyway.

This revision is now accepted and ready to land.Apr 15 2015, 3:50 PM

r235053, thanks

thakis closed this revision.Apr 15 2015, 4:10 PM