r178741 - Add hasExternalLinkageUncached back with the test that Richard provided, but

Rafael EspĂ­ndola rafael.espindola at gmail.com
Thu Apr 4 06:45:48 PDT 2013


> Add hasExternalLinkageUncached back with the test that Richard provided, but
> keep the call at the current location.

I was trying to figure out what these hidden decl are. My
understanding so far is:

* Modules are handle liked a unit, so loading a module semantically
loads all sub modules, but they can be hidden.
* An external variable/function in a hidden sub module still conflicts
with an external variable/function in the TU importing the module. Is
this is some form of ODR for modules?
* An internal variable/function in a hidden sub module doesn't
interfere with the TU importing the module.
* An external variable/function in a hidden sub module doesn't
interfere with a hidden variable/function in the TU importing the
module.

This last item I find surprising if the objective is really some form
of ODR. In particular, I would expect an error for f1 and v1 in
Modules/linkage-merge.m. I would also expect an error in the peculiar
case Richard mentioned last night:

hidden sub module:
-------------------------
extern const int foo;
------------------------
TU importing the module:
----------------------------
const int foo = 32;
-------------------------

but currently they are not linked and we accept it.

In any case. Even if we want the current semantics, I think we can
implement them without hasExternalLinkageUncached. We just need to see
what we are about to link with. At this point if we are linking with a
hidden declaration, it is safe to compute the linkage of the new one,
since we know we will only link if the linkage is not change.

The attached patch implements that. Is it OK?

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


More information about the cfe-commits mailing list