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

Richard Smith richard at metafoo.co.uk
Wed Aug 28 16:10:10 PDT 2013


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.


> 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.


> 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.


> That's all I can think of, at least for now.
>

Thanks!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130828/09c67176/attachment.html>


More information about the cfe-commits mailing list