[patch] Cleanup handling of UniqueExternalLinkage.

Rafael EspĂ­ndola rafael.espindola at gmail.com
Fri May 10 07:11:07 PDT 2013


>> The attached patch is a nop. It just replaces most uses of getLinkage
>> with getSemaLinkage and getCodeGenLinkage. Some of these calls should
>> be audited to make sure they are calling the right function, but that
>> is probably better done in an independent patch, so this one is
>> mechanical:
>>
>> hasExternalLinkage -> hasExternalCodeGenLinkage
>
> I dislike the "CodeGen" / "Sema" split here.  The semantic property that
> IR-generation cares about is whether the declaration is permitted to be
> the same declaration under the ODR as a hypothetical declaration in
> another translation unit.  That's what Sema usually cares about, too;
> I would guess that only some narrow formalistic cases really want to
> think of e.g. vector<MyInternalType> as having external linkage.

I guess the Sema part is probably ok, since it is the part responsible
for making

namespace {
  void f();
  static void f();
}

Invalid on c++98 and valid on c++11 for example. But yes, the CodeGen
name here is a bit odd since many parts of Sema need to reason about
it too. Fortunately, all that we really care is if it is external or
not. What do you think about the attached patch. Is just uses the name
isVisibleFromAnotheTU for what was "CodeGen linkage" in the previous
patch.

> John.

Cheers,
Rafael
-------------- next part --------------
A non-text attachment was scrubbed...
Name: t.patch
Type: application/octet-stream
Size: 29000 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130510/317bcefb/attachment.obj>


More information about the cfe-commits mailing list