<div dir="ltr">This seems a little curious, so you'll have code like this:<br><br>  decl foo<br>  module<br>    def bar<br>       member foo pointer (references the declaration of foo outside the module, in the CU?)<br><br>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>  </div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Oct 2, 2015 at 10:36 AM, Adrian Prantl 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">Author: adrian<br>
Date: Fri Oct  2 12:36:14 2015<br>
New Revision: 249157<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=249157&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project?rev=249157&view=rev</a><br>
Log:<br>
Module debugging: Don't emit forward declarations in module scopes.<br>
A forward declaration inside a module header does not belong to the module.<br>
<br>
Modified:<br>
    cfe/trunk/lib/CodeGen/CGDebugInfo.cpp<br>
    cfe/trunk/test/Modules/Inputs/DebugObjC.h<br>
    cfe/trunk/test/Modules/ModuleDebugInfo.m<br>
<br>
Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp<br>
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">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=249157&r1=249156&r2=249157&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original)<br>
+++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Fri Oct  2 12:36:14 2015<br>
@@ -2172,6 +2172,9 @@ ObjCInterfaceDecl *CGDebugInfo::getObjCI<br>
 }<br>
<br>
 llvm::DIModule *CGDebugInfo::getParentModuleOrNull(const Decl *D) {<br>
+  // A forward declaration inside a module header does not belong to the module.<br>
+  if (isa<RecordDecl>(D) && !cast<RecordDecl>(D)->getDefinition())<br>
+    return nullptr;<br>
   if (DebugTypeExtRefs && D->isFromASTFile()) {<br>
     // Record a reference to an imported clang module or precompiled header.<br>
     auto *Reader = CGM.getContext().getExternalSource();<br>
<br>
Modified: cfe/trunk/test/Modules/Inputs/DebugObjC.h<br>
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">http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/Inputs/DebugObjC.h?rev=249157&r1=249156&r2=249157&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/test/Modules/Inputs/DebugObjC.h (original)<br>
+++ cfe/trunk/test/Modules/Inputs/DebugObjC.h Fri Oct  2 12:36:14 2015<br>
@@ -5,6 +5,7 @@<br>
 }<br>
 + classMethod;<br>
 - instanceMethodWithInt:(int)i;<br>
+- (struct OpaqueData*) getSomethingOpaque;<br>
 @property int property;<br>
 @end<br>
<br>
<br>
Modified: cfe/trunk/test/Modules/ModuleDebugInfo.m<br>
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">http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/ModuleDebugInfo.m?rev=249157&r1=249156&r2=249157&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/test/Modules/ModuleDebugInfo.m (original)<br>
+++ cfe/trunk/test/Modules/ModuleDebugInfo.m Fri Oct  2 12:36:14 2015<br>
@@ -41,3 +41,6 @@<br>
 // MODULE-CHECK: !DICompositeType(tag: DW_TAG_structure_type,<br>
 // MODULE-CHECK-SAME:             name: "ObjCClass",<br>
 // MODULE-CHECK-SAME:             scope: ![[MODULE]],<br>
+<br>
+// The forward declaration should not be in the module scope.<br>
+// MODULE-CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "OpaqueData", file<br>
<br>
<br>
_______________________________________________<br>
cfe-commits mailing list<br>
<a href="mailto:cfe-commits@lists.llvm.org">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/mailman/listinfo/cfe-commits</a><br>
</blockquote></div><br></div>