<div dir="ltr">Sure, I committed r310829 which moves the lexical decl adjustment.<div><br></div><div>Hans, can you please merge r310706 with r310829.</div><div><br></div><div>Cheers,</div><div>Alex</div></div><div class="gmail_extra"><br><div class="gmail_quote">On 12 August 2017 at 01:29, Richard Smith <span dir="ltr"><<a href="mailto:richard@metafoo.co.uk" target="_blank">richard@metafoo.co.uk</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div><div class="h5">On 11 August 2017 at 17:20, Bruno Cardoso Lopes via cfe-commits <span dir="ltr"><<a href="mailto:cfe-commits@lists.llvm.org" target="_blank">cfe-commits@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Alex,<br>
<div><div class="m_871460027110412960h5"><br>
On Fri, Aug 11, 2017 at 9:06 AM, Alex Lorenz via cfe-commits<br>
<<a href="mailto:cfe-commits@lists.llvm.org" target="_blank">cfe-commits@lists.llvm.org</a>> wrote:<br>
> Author: arphaman<br>
> Date: Fri Aug 11 05:06:52 2017<br>
> New Revision: 310706<br>
><br>
> URL: <a href="http://llvm.org/viewvc/llvm-project?rev=310706&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-pr<wbr>oject?rev=310706&view=rev</a><br>
> Log:<br>
> [modules] Set the lexical DC for dummy tag decls that refer to hidden<br>
> declarations that are made visible after the dummy is parsed and ODR verified<br>
><br>
> Prior to this commit the<br>
> "(getContainingDC(DC) == CurContext && "The next DeclContext should be lexically contained in the current one."),"<br>
> assertion failure was triggered during semantic analysis of the dummy<br>
> tag declaration that was declared in another tag declaration because its<br>
> lexical context did not point to the outer tag decl.<br>
><br>
> rdar://32292196<br>
><br>
> Added:<br>
>     cfe/trunk/test/Modules/<wbr>Inputs/innerstructredef.h<br>
>     cfe/trunk/test/Modules/inner-<wbr>struct-redefines-invisible.m<br>
> Modified:<br>
>     cfe/trunk/lib/Sema/SemaDecl.c<wbr>pp<br>
>     cfe/trunk/test/Modules/<wbr>Inputs/module.map<br>
><br>
> Modified: cfe/trunk/lib/Sema/SemaDecl.cp<wbr>p<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=310706&r1=310705&r2=310706&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-pr<wbr>oject/cfe/trunk/lib/Sema/SemaD<wbr>ecl.cpp?rev=310706&r1=310705&<wbr>r2=310706&view=diff</a><br>
> ==============================<wbr>==============================<wbr>==================<br>
> --- cfe/trunk/lib/Sema/SemaDecl.cp<wbr>p (original)<br>
> +++ cfe/trunk/lib/Sema/SemaDecl.cp<wbr>p Fri Aug 11 05:06:52 2017<br>
> @@ -13722,6 +13722,7 @@ Decl *Sema::ActOnTag(Scope *S, unsigned<br>
>                    // comparison.<br>
>                    SkipBody->CheckSameAsPrevious = true;<br>
>                    SkipBody->New = createTagFromNewDecl();<br>
> +                  SkipBody->New->setLexicalDeclC<wbr>ontext(CurContext);<br>
<br>
</div></div>I think it would be cleaner to do this inside "createTagFromNewDecl" than here.</blockquote><div><br></div></div></div><div>I agree. Either before or after that change, this seems sufficiently isolated and low-risk that it makes sense to take it for Clang 5.</div><div><div class="h5"><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="m_871460027110412960HOEnZb"><div class="m_871460027110412960h5">
>                    SkipBody->Previous = Hidden;<br>
>                  } else {<br>
>                    SkipBody->ShouldSkip = true;<br>
><br>
> Added: cfe/trunk/test/Modules/Inputs/<wbr>innerstructredef.h<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/Inputs/innerstructredef.h?rev=310706&view=auto" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-pr<wbr>oject/cfe/trunk/test/Modules/<wbr>Inputs/innerstructredef.h?rev=<wbr>310706&view=auto</a><br>
> ==============================<wbr>==============================<wbr>==================<br>
> --- cfe/trunk/test/Modules/Inputs/<wbr>innerstructredef.h (added)<br>
> +++ cfe/trunk/test/Modules/Inputs/<wbr>innerstructredef.h Fri Aug 11 05:06:52 2017<br>
> @@ -0,0 +1,6 @@<br>
> +struct Outer {<br>
> +// This definition is actually hidden since only submodule 'one' is imported.<br>
> +struct Inner {<br>
> +  int x;<br>
> +} field;<br>
> +};<br>
><br>
> Modified: cfe/trunk/test/Modules/Inputs/<wbr>module.map<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/Inputs/module.map?rev=310706&r1=310705&r2=310706&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-pr<wbr>oject/cfe/trunk/test/Modules/<wbr>Inputs/module.map?rev=310706&<wbr>r1=310705&r2=310706&view=diff</a><br>
> ==============================<wbr>==============================<wbr>==================<br>
> --- cfe/trunk/test/Modules/Inputs/<wbr>module.map (original)<br>
> +++ cfe/trunk/test/Modules/Inputs/<wbr>module.map Fri Aug 11 05:06:52 2017<br>
> @@ -451,3 +451,12 @@ module DebugNestedB {<br>
>  module objcAtKeywordMissingEnd {<br>
>    header "objcAtKeywordMissingEnd.h"<br>
>  }<br>
> +<br>
> +module innerstructredef {<br>
> +  module one {<br>
> +    header "empty.h"<br>
> +  }<br>
> +  module two {<br>
> +   header "innerstructredef.h"<br>
> +  }<br>
> +}<br>
><br>
> Added: cfe/trunk/test/Modules/inner-s<wbr>truct-redefines-invisible.m<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/inner-struct-redefines-invisible.m?rev=310706&view=auto" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-pr<wbr>oject/cfe/trunk/test/Modules/<wbr>inner-struct-redefines-<wbr>invisible.m?rev=310706&view=<wbr>auto</a><br>
> ==============================<wbr>==============================<wbr>==================<br>
> --- cfe/trunk/test/Modules/inner-s<wbr>truct-redefines-invisible.m (added)<br>
> +++ cfe/trunk/test/Modules/inner-s<wbr>truct-redefines-invisible.m Fri Aug 11 05:06:52 2017<br>
> @@ -0,0 +1,12 @@<br>
> +// RUN: rm -rf %t<br>
> +// RUN: %clang_cc1 -fsyntax-only -I%S/Inputs -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -verify %s<br>
> +// expected-no-diagnostics<br>
> +<br>
> +@import innerstructredef.one;<br>
> +<br>
> +struct Outer {<br>
> +// Should set lexical context when parsing 'Inner' here, otherwise there's a crash:<br>
> +struct Inner {<br>
> +  int x;<br>
> +} field;<br>
> +};<br>
><br>
><br>
> ______________________________<wbr>_________________<br>
> cfe-commits mailing list<br>
> <a href="mailto:cfe-commits@lists.llvm.org" target="_blank">cfe-commits@lists.llvm.org</a><br>
> <a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/cfe-commits</a><br>
<br>
<br>
<br>
</div></div><span class="m_871460027110412960HOEnZb"><font color="#888888">--<br>
Bruno Cardoso Lopes<br>
<a href="http://www.brunocardoso.cc" rel="noreferrer" target="_blank">http://www.brunocardoso.cc</a><br>
</font></span><div class="m_871460027110412960HOEnZb"><div class="m_871460027110412960h5">______________________________<wbr>_________________<br>
cfe-commits mailing list<br>
<a href="mailto:cfe-commits@lists.llvm.org" target="_blank">cfe-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/cfe-commits</a><br>
</div></div></blockquote></div></div></div><br></div></div>
</blockquote></div><br></div>