<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Mar 10, 2016, at 3:21 PM, David Blaikie <<a href="mailto:dblaikie@gmail.com" class="">dblaikie@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class="">OK, so the idea is that when you see that a tag definition, skip it if any parent is incomplete - because when the parent's definition is complete, you'll emit all its children anyway?</div></div></blockquote><div><br class=""></div>Yes. If there’s a more direct way top achieve this without walking the declcontext, that would be even better of course.</div><div><br class=""></div><div>-- adrian<br class=""><blockquote type="cite" class=""><div class=""><div class="gmail_extra"><br class=""><div class="gmail_quote">On Thu, Mar 10, 2016 at 8:19 AM, Adrian Prantl <span dir="ltr" class=""><<a href="mailto:aprantl@apple.com" target="_blank" class="">aprantl@apple.com</a>></span> wrote:<br class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class=""><br class="">
> On Mar 9, 2016, at 5:22 PM, David Blaikie <<a href="mailto:dblaikie@gmail.com" class="">dblaikie@gmail.com</a>> wrote:<br class="">
><br class="">
> Is this bug only reachable with modules debug info?<br class="">
<br class="">
</span>Yes, it’s in ObjectFilePCHContainerOperations.cpp, which is only used while building a PCH or module with -gmodules.<br class="">
<span class=""><br class="">
> Could you describe the nature of the fix (not quite clear to me just by looking at it)<br class="">
<br class="">
</span>In the ASTConsumer callback for a finished TagDecl, we check whether the DeclContext is complete and only try to emit debug info for the Decl if the DeclContext is available.<br class="">
<span class="HOEnZb"><font color="#888888" class=""><br class="">
-- adrian<br class="">
</font></span><div class="HOEnZb"><div class="h5"><br class="">
><br class="">
> On Mon, Mar 7, 2016 at 12:58 PM, Adrian Prantl via cfe-commits <<a href="mailto:cfe-commits@lists.llvm.org" class="">cfe-commits@lists.llvm.org</a>> wrote:<br class="">
> Author: adrian<br class="">
> Date: Mon Mar  7 14:58:52 2016<br class="">
> New Revision: 262851<br class="">
><br class="">
> URL: <a href="http://llvm.org/viewvc/llvm-project?rev=262851&view=rev" rel="noreferrer" target="_blank" class="">http://llvm.org/viewvc/llvm-project?rev=262851&view=rev</a><br class="">
> Log:<br class="">
> Module Debugging: Fix a crash when emitting debug info for nested tag types<br class="">
> whose DeclContext is not yet complete by deferring their emission.<br class="">
><br class="">
> <a href="rdar://problem/24918680" class="">rdar://problem/24918680</a><br class="">
><br class="">
> Modified:<br class="">
>     cfe/trunk/lib/CodeGen/ObjectFilePCHContainerOperations.cpp<br class="">
>     cfe/trunk/test/Modules/Inputs/DebugCXX.h<br class="">
>     cfe/trunk/test/Modules/ModuleDebugInfo.cpp<br class="">
><br class="">
> Modified: cfe/trunk/lib/CodeGen/ObjectFilePCHContainerOperations.cpp<br class="">
> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/ObjectFilePCHContainerOperations.cpp?rev=262851&r1=262850&r2=262851&view=diff" rel="noreferrer" target="_blank" class="">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/ObjectFilePCHContainerOperations.cpp?rev=262851&r1=262850&r2=262851&view=diff</a><br class="">
> ==============================================================================<br class="">
> --- cfe/trunk/lib/CodeGen/ObjectFilePCHContainerOperations.cpp (original)<br class="">
> +++ cfe/trunk/lib/CodeGen/ObjectFilePCHContainerOperations.cpp Mon Mar  7 14:58:52 2016<br class="">
> @@ -201,6 +201,15 @@ public:<br class="">
>      if (D->getName().empty())<br class="">
>        return;<br class="">
><br class="">
> +    // Defer tag decls until their declcontext is complete.<br class="">
> +    auto *DeclCtx = D->getDeclContext();<br class="">
> +    while (DeclCtx) {<br class="">
> +      if (auto *D = dyn_cast<TagDecl>(DeclCtx))<br class="">
> +        if (!D->isCompleteDefinition())<br class="">
> +          return;<br class="">
> +      DeclCtx = DeclCtx->getParent();<br class="">
> +    }<br class="">
> +<br class="">
>      DebugTypeVisitor DTV(*Builder->getModuleDebugInfo(), *Ctx);<br class="">
>      DTV.TraverseDecl(D);<br class="">
>      Builder->UpdateCompletedType(D);<br class="">
><br class="">
> Modified: cfe/trunk/test/Modules/Inputs/DebugCXX.h<br class="">
> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/Inputs/DebugCXX.h?rev=262851&r1=262850&r2=262851&view=diff" rel="noreferrer" target="_blank" class="">http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/Inputs/DebugCXX.h?rev=262851&r1=262850&r2=262851&view=diff</a><br class="">
> ==============================================================================<br class="">
> --- cfe/trunk/test/Modules/Inputs/DebugCXX.h (original)<br class="">
> +++ cfe/trunk/test/Modules/Inputs/DebugCXX.h Mon Mar  7 14:58:52 2016<br class="">
> @@ -72,3 +72,14 @@ namespace {<br class="">
>      struct InAnonymousNamespace { int i; };<br class="">
>    }<br class="">
>  }<br class="">
> +<br class="">
> +class Base;<br class="">
> +class A {<br class="">
> +  virtual Base *getParent() const;<br class="">
> +};<br class="">
> +class Base {};<br class="">
> +class Derived : Base {<br class="">
> +  class B : A {<br class="">
> +    Derived *getParent() const override;<br class="">
> +  };<br class="">
> +};<br class="">
><br class="">
> Modified: cfe/trunk/test/Modules/ModuleDebugInfo.cpp<br class="">
> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/ModuleDebugInfo.cpp?rev=262851&r1=262850&r2=262851&view=diff" rel="noreferrer" target="_blank" class="">http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/ModuleDebugInfo.cpp?rev=262851&r1=262850&r2=262851&view=diff</a><br class="">
> ==============================================================================<br class="">
> --- cfe/trunk/test/Modules/ModuleDebugInfo.cpp (original)<br class="">
> +++ cfe/trunk/test/Modules/ModuleDebugInfo.cpp Mon Mar  7 14:58:52 2016<br class="">
> @@ -71,6 +71,13 @@<br class="">
>  // CHECK-NOT:              name:<br class="">
>  // CHECK-SAME:             identifier: "_ZTS13TypedefStruct")<br class="">
><br class="">
> +// CHECK: !DICompositeType(tag: DW_TAG_class_type, name: "Derived",<br class="">
> +// CHECK-SAME:             identifier: "_ZTS7Derived")<br class="">
> +// CHECK: !DICompositeType(tag: DW_TAG_class_type, name: "B", scope: !"_ZTS7Derived",<br class="">
> +// CHECK-SAME:             elements: ![[B_MBRS:.*]], vtableHolder: !"_ZTS1A"<br class="">
> +// CHECK: ![[B_MBRS]] = !{{{.*}}, ![[GET_PARENT:.*]]}<br class="">
> +// CHECK: ![[GET_PARENT]] = !DISubprogram(name: "getParent"<br class="">
> +<br class="">
>  // CHECK: !DIDerivedType(tag: DW_TAG_typedef, name: "FloatInstatiation"<br class="">
>  // no mangled name here yet.<br class="">
><br class="">
><br class="">
><br class="">
> _______________________________________________<br class="">
> cfe-commits mailing list<br class="">
> <a href="mailto:cfe-commits@lists.llvm.org" class="">cfe-commits@lists.llvm.org</a><br class="">
> <a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits" rel="noreferrer" target="_blank" class="">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits</a><br class="">
><br class="">
<br class="">
</div></div></blockquote></div><br class=""></div>
</div></blockquote></div><br class=""></body></html>