[patch] Refactor linkage computation in CGObjCMac.cpp
rafael.espindola at gmail.com
Thu Feb 20 14:08:39 PST 2014
Back in http://llvm.org/bugs/show_bug.cgi?id=3267#c4 when I first
added private linkage Chris noted that "Darwin has a similar class of
thing and a lot of ObjC metadata has this sort of symbol. We're
hacking around it by setting DECL_ASSEMBLER_NAME to include the prefix
for darwin, which is ugly."
A similar hack still lives in clang today. Now that PR18743 has been
fixed, I was curious to see if that could be fixed too. It looks like
it can, but the logic for computing the linkage is a bit convoluted,
so I decided to fix that first.
Currently the globals are created with the wrong linkage and patched
afterwards. From the comments it looks like something would complain
about having an internal GV with no initializer. At least in clang the
verifier will only run way after we set the initializer, so that is
not a problem.
The attached patch should be a nop. It just figures out the linkage
earlier and converts the old calls to setLinkage to asserts. The only
case where that is not possible is when we first see a weak import
that is then implemented. In that case we have to change the linkage,
but that is the only setLinkage left.
As an additional test I have compiled chromium with a patched clang
and used it to write this email :-)
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 17421 bytes
Desc: not available
More information about the cfe-commits