<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></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 Oct 2, 2015, at 2:18 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="">This seems a little curious, so you'll have code like this:<br class=""><br class="">  decl foo<br class="">  module<br class="">    def bar<br class="">       member foo pointer (references the declaration of foo outside the module, in the CU?)<br class=""><br class=""></div></div></blockquote><div><br class=""></div><div>Right.</div><br class=""><blockquote type="cite" class=""><div dir="ltr" class="">Why is that preferable to DWARF that looks more like the AST where the declaration of foo appears in the first module that references it, rather than, in a curiously circular situation, in the CU that references the module?<br class=""></div></blockquote><div><br class=""></div><div>The problem I had with this was that a forward declaration would end up in a DeclContext that is not the DeclContext of the definition. Looking at this through the dsymutil goggles, the different DeclContexts effectively prevent the forward declaration from being uniqued with the type's definition.</div><div><br class=""></div><div>-- adrian</div><div><br class=""></div><blockquote type="cite" class=""><div class=""><div class="gmail_extra"><div class="gmail_quote">On Fri, Oct 2, 2015 at 10:36 AM, Adrian Prantl via cfe-commits <span dir="ltr" class=""><<a href="mailto:cfe-commits@lists.llvm.org" target="_blank" class="">cfe-commits@lists.llvm.org</a>></span> wrote:<br class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: adrian<br class="">
Date: Fri Oct  2 12:36:14 2015<br class="">
New Revision: 249157<br class="">
<br class="">
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=249157&view=rev" rel="noreferrer" target="_blank" class="">http://llvm.org/viewvc/llvm-project?rev=249157&view=rev</a><br class="">
Log:<br class="">
Module debugging: Don't emit forward declarations in module scopes.<br class="">
A forward declaration inside a module header does not belong to the module.<br class="">
<br class="">
Modified:<br class="">
    cfe/trunk/lib/CodeGen/CGDebugInfo.cpp<br class="">
    cfe/trunk/test/Modules/Inputs/DebugObjC.h<br class="">
    cfe/trunk/test/Modules/ModuleDebugInfo.m<br class="">
<br class="">
Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp<br class="">
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=249157&r1=249156&r2=249157&view=diff" rel="noreferrer" target="_blank" class="">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=249157&r1=249156&r2=249157&view=diff</a><br class="">
==============================================================================<br class="">
--- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original)<br class="">
+++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Fri Oct  2 12:36:14 2015<br class="">
@@ -2172,6 +2172,9 @@ ObjCInterfaceDecl *CGDebugInfo::getObjCI<br class="">
 }<br class="">
<br class="">
 llvm::DIModule *CGDebugInfo::getParentModuleOrNull(const Decl *D) {<br class="">
+  // A forward declaration inside a module header does not belong to the module.<br class="">
+  if (isa<RecordDecl>(D) && !cast<RecordDecl>(D)->getDefinition())<br class="">
+    return nullptr;<br class="">
   if (DebugTypeExtRefs && D->isFromASTFile()) {<br class="">
     // Record a reference to an imported clang module or precompiled header.<br class="">
     auto *Reader = CGM.getContext().getExternalSource();<br class="">
<br class="">
Modified: cfe/trunk/test/Modules/Inputs/DebugObjC.h<br class="">
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/Inputs/DebugObjC.h?rev=249157&r1=249156&r2=249157&view=diff" rel="noreferrer" target="_blank" class="">http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/Inputs/DebugObjC.h?rev=249157&r1=249156&r2=249157&view=diff</a><br class="">
==============================================================================<br class="">
--- cfe/trunk/test/Modules/Inputs/DebugObjC.h (original)<br class="">
+++ cfe/trunk/test/Modules/Inputs/DebugObjC.h Fri Oct  2 12:36:14 2015<br class="">
@@ -5,6 +5,7 @@<br class="">
 }<br class="">
 + classMethod;<br class="">
 - instanceMethodWithInt:(int)i;<br class="">
+- (struct OpaqueData*) getSomethingOpaque;<br class="">
 @property int property;<br class="">
 @end<br class="">
<br class="">
<br class="">
Modified: cfe/trunk/test/Modules/ModuleDebugInfo.m<br class="">
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/ModuleDebugInfo.m?rev=249157&r1=249156&r2=249157&view=diff" rel="noreferrer" target="_blank" class="">http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/ModuleDebugInfo.m?rev=249157&r1=249156&r2=249157&view=diff</a><br class="">
==============================================================================<br class="">
--- cfe/trunk/test/Modules/ModuleDebugInfo.m (original)<br class="">
+++ cfe/trunk/test/Modules/ModuleDebugInfo.m Fri Oct  2 12:36:14 2015<br class="">
@@ -41,3 +41,6 @@<br class="">
 // MODULE-CHECK: !DICompositeType(tag: DW_TAG_structure_type,<br class="">
 // MODULE-CHECK-SAME:             name: "ObjCClass",<br class="">
 // MODULE-CHECK-SAME:             scope: ![[MODULE]],<br class="">
+<br class="">
+// The forward declaration should not be in the module scope.<br class="">
+// MODULE-CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "OpaqueData", file<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="">
</blockquote></div><br class=""></div>
</div></blockquote></div><br class=""></body></html>