[cfe-commits] r101953 - /cfe/trunk/lib/AST/Decl.cpp

Douglas Gregor dgregor at apple.com
Tue Apr 20 23:27:11 PDT 2010


On Apr 20, 2010, at 11:13 PM, Chris Lattner wrote:

>>>> Can you explain a bit about why this makes you uncomfortable? From my perspective, all of the Objective-C declarations have external linkage since they are visible from multiple translation units.
>>> 
>>> Except for meta-data for the class (and its metaclass), othere meta-data have non-external linkage.
>>> Content of all non-external metadata, however,  can be inspected with various APIs. In that respect they are 'external'.
>>> But not wrt linkage.
>> 
>> I'm looking at linkage more from the language perspective. For example, say we have:
>> 
>> @interface A
>> @end
>> 
>> A *an_A;
>> 
>> Is this code well-formed? In C++, it actually depends on the linkage of A: if A has no linkage, then the program is ill-formed because an_A does have linkage. Also, one could imagine instantiating a template over an Objective-C class (or pointer to one), e.g.,
>> 
>> std::vector<A *> a_objects;
>> 
>> which also requires A to have linkage.
> 
> How about "if 'a' has a defined/stable mangling, then it has linkage".  Is this close enough to be a useful guideline?


It's close, although it doesn't capture entities declared in anonymous namespaces, which have external linkage (from the language perspective) but no stable mangling.

	- Doug






More information about the cfe-commits mailing list