[PATCH] Use correct semantic DeclContext for local declarations of variables and functions with linkage

Richard Smith richard at metafoo.co.uk
Wed Sep 11 16:42:11 PDT 2013


Ping


On Tue, Sep 3, 2013 at 6:56 PM, Richard Smith <richard at metafoo.co.uk> wrote:

> On Wed, Aug 28, 2013 at 4:10 PM, Richard Smith <richard at metafoo.co.uk>wrote:
>
>> On Wed, Aug 28, 2013 at 3:47 PM, Eli Friedman <eli.friedman at gmail.com>wrote:
>>
>>> The concept generally seems fine.
>>>
>>> The setLocalExternDecl thing seems a bit fiddly, since I'm pretty sure
>>> it can be derived from information we already keep around.  Did you
>>> consider computing that information on demand?
>>>
>>
>> Yes, that's certainly possible. It's convenient for this to be part of
>> the IdentifierNamespace, and I don't want to complicate the hot path
>> through name lookup with this special case any more than necessary, but I
>> don't have any benchmarks to justify doing it this way.
>>
>>
>>> Do we compute the correct DeclContext for a friend in a local class
>>> which is a redeclaration of a local extern decl?  Might be nice to test.
>>>
>>
>> Yes, we do; I'll add a test for that.
>>
>
> This turns out to be hard (impossible?) to observe, since a local friend
> must be a redeclaration of an entity in the innermost surrounding block
> scope, but I've added a test for this interaction in general.
>
>
>> It looks like some changes slipped in which should be committed
>>> separately (around where you added the reference to 6.2.7p2).
>>>
>>
>> I separately committed the functional part of those changes, but I'll
>> take another pass and see if there's more that I can split out here.
>>
>
> Done.
>
>
>>  Does you patch work correctly with an extern local decl inside a block?
>>>  e.g. "void f() { ^{ void extern_decl(); extern_decl(); }(); }"?
>>>
>>
>> Yes. I'll add a test for that, too.
>>
>
> Done.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130911/cfbfcdc2/attachment.html>


More information about the cfe-commits mailing list