<div dir="ltr">It'd be handy to include details of what's different about this commit than the previous time it was committed - makes review easier by focusing on the new changes. (for some commits where I've recommitted them a few times I end up with a bit of a timeline/history in the commit message - "fixed this by doing this, fixed that by doing the other thing, etc" which can help reviewers see what sort of issues this patch has in general & may spot other cases by following that trend)</div><br><div class="gmail_quote"><div dir="ltr">On Thu, Jul 21, 2016 at 11:50 AM Adrian McCarthy via cfe-commits <<a href="mailto:cfe-commits@lists.llvm.org">cfe-commits@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: amccarth<br>
Date: Thu Jul 21 13:43:20 2016<br>
New Revision: 276317<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=276317&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project?rev=276317&view=rev</a><br>
Log:<br>
Reroll "Include unreferenced nested types in member list only for CodeView"<br>
<br>
Another attempt at r276271, hopefully without breaking ModuleDebugInfo test.<br>
<br>
Modified:<br>
    cfe/trunk/lib/CodeGen/CGDebugInfo.cpp<br>
    cfe/trunk/lib/CodeGen/CGDebugInfo.h<br>
    cfe/trunk/test/CodeGenCXX/debug-info-dup-fwd-decl.cpp<br>
    cfe/trunk/test/CodeGenCXX/debug-info-ms-abi.cpp<br>
    cfe/trunk/test/Modules/ModuleDebugInfo.cpp<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=276317&r1=276316&r2=276317&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=276317&r1=276316&r2=276317&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original)<br>
+++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Thu Jul 21 13:43:20 2016<br>
@@ -1090,6 +1090,14 @@ void CGDebugInfo::CollectRecordNormalFie<br>
   elements.push_back(FieldType);<br>
 }<br>
<br>
+void CGDebugInfo::CollectRecordNestedRecord(<br>
+    const RecordDecl *RD, SmallVectorImpl<llvm::Metadata *> &elements) {<br>
+  QualType Ty = CGM.getContext().getTypeDeclType(RD);<br>
+  SourceLocation Loc = RD->getLocation();<br>
+  llvm::DIType *nestedType = getOrCreateType(Ty, getOrCreateFile(Loc));<br>
+  elements.push_back(nestedType);<br>
+}<br>
+<br>
 void CGDebugInfo::CollectRecordFields(<br>
     const RecordDecl *record, llvm::DIFile *tunit,<br>
     SmallVectorImpl<llvm::Metadata *> &elements,<br>
@@ -1101,6 +1109,10 @@ void CGDebugInfo::CollectRecordFields(<br>
   else {<br>
     const ASTRecordLayout &layout = CGM.getContext().getASTRecordLayout(record);<br>
<br>
+    // Debug info for nested records is included in the member list only for<br>
+    // CodeView.<br>
+    bool IncludeNestedRecords = CGM.getCodeGenOpts().EmitCodeView;<br>
+<br>
     // Field number for non-static fields.<br>
     unsigned fieldNo = 0;<br>
<br>
@@ -1126,7 +1138,10 @@ void CGDebugInfo::CollectRecordFields(<br>
<br>
         // Bump field number for next field.<br>
         ++fieldNo;<br>
-      }<br>
+      } else if (const auto *nestedRec = dyn_cast<CXXRecordDecl>(I))<br>
+        if (IncludeNestedRecords && !nestedRec->isImplicit() &&<br>
+            nestedRec->getDeclContext() == record)<br>
+          CollectRecordNestedRecord(nestedRec, elements);<br>
   }<br>
 }<br>
<br>
@@ -3620,8 +3635,8 @@ void CGDebugInfo::EmitUsingDirective(con<br>
   if (CGM.getCodeGenOpts().getDebugInfo() < codegenoptions::LimitedDebugInfo)<br>
     return;<br>
   const NamespaceDecl *NSDecl = UD.getNominatedNamespace();<br>
-  if (!NSDecl->isAnonymousNamespace() ||<br>
-      CGM.getCodeGenOpts().DebugExplicitImport) {<br>
+  if (!NSDecl->isAnonymousNamespace() ||<br>
+      CGM.getCodeGenOpts().DebugExplicitImport) {<br>
     DBuilder.createImportedModule(<br>
         getCurrentContextDescriptor(cast<Decl>(UD.getDeclContext())),<br>
         getOrCreateNameSpace(NSDecl),<br>
<br>
Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.h?rev=276317&r1=276316&r2=276317&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.h?rev=276317&r1=276316&r2=276317&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/lib/CodeGen/CGDebugInfo.h (original)<br>
+++ cfe/trunk/lib/CodeGen/CGDebugInfo.h Thu Jul 21 13:43:20 2016<br>
@@ -254,6 +254,8 @@ class CGDebugInfo {<br>
                                 llvm::DIFile *F,<br>
                                 SmallVectorImpl<llvm::Metadata *> &E,<br>
                                 llvm::DIType *RecordTy, const RecordDecl *RD);<br>
+  void CollectRecordNestedRecord(const RecordDecl *RD,<br>
+                                 SmallVectorImpl<llvm::Metadata *> &E);<br>
   void CollectRecordFields(const RecordDecl *Decl, llvm::DIFile *F,<br>
                            SmallVectorImpl<llvm::Metadata *> &E,<br>
                            llvm::DICompositeType *RecordTy);<br>
<br>
Modified: cfe/trunk/test/CodeGenCXX/debug-info-dup-fwd-decl.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/debug-info-dup-fwd-decl.cpp?rev=276317&r1=276316&r2=276317&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/debug-info-dup-fwd-decl.cpp?rev=276317&r1=276316&r2=276317&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/test/CodeGenCXX/debug-info-dup-fwd-decl.cpp (original)<br>
+++ cfe/trunk/test/CodeGenCXX/debug-info-dup-fwd-decl.cpp Thu Jul 21 13:43:20 2016<br>
@@ -19,6 +19,6 @@ protected:<br>
<br>
 Test t;<br>
<br>
-// CHECK: !DIDerivedType(tag: DW_TAG_pointer_type<br>
 // CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "data"<br>
+// CHECK: !DIDerivedType(tag: DW_TAG_pointer_type<br>
 // CHECK-NOT: !DICompositeType(tag: DW_TAG_structure_type, name: "data"<br>
<br>
Modified: cfe/trunk/test/CodeGenCXX/debug-info-ms-abi.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/debug-info-ms-abi.cpp?rev=276317&r1=276316&r2=276317&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/debug-info-ms-abi.cpp?rev=276317&r1=276316&r2=276317&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/test/CodeGenCXX/debug-info-ms-abi.cpp (original)<br>
+++ cfe/trunk/test/CodeGenCXX/debug-info-ms-abi.cpp Thu Jul 21 13:43:20 2016<br>
@@ -1,4 +1,4 @@<br>
-// RUN: %clang_cc1 %s -triple=i686-pc-windows-msvc -debug-info-kind=limited -emit-llvm -o - | FileCheck %s<br>
+// RUN: %clang_cc1 %s -triple=i686-pc-windows-msvc -debug-info-kind=limited -gcodeview -emit-llvm -o - | FileCheck %s<br>
<br>
 // Tests that certain miscellaneous features work in the MS ABI.<br>
<br>
@@ -12,19 +12,22 @@ Foo f;<br>
 Foo::Nested n;<br>
<br>
 // CHECK: ![[Foo:[^ ]*]] = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "Foo",<br>
+// CHECK-SAME: elements: ![[elements:[0-9]+]]<br>
 // CHECK-SAME: identifier: ".?AUFoo@@"<br>
<br>
-// CHECK: !DISubprogram(name: "f",<br>
+// CHECK: ![[elements]] = !{![[vptr:[0-9]+]], ![[Nested:[0-9]+]], ![[f:[0-9]+]], ![[g:[0-9]+]], ![[h:[0-9]+]]}<br>
+<br>
+// CHECK: ![[Nested]] = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "Nested",<br>
+// CHECK-SAME: identifier: ".?AUNested@Foo@@"<br>
+<br>
+// CHECK: ![[f]] = !DISubprogram(name: "f",<br>
 // CHECK-SAME: containingType: ![[Foo]], virtuality: DW_VIRTUALITY_virtual, virtualIndex: 0,<br>
 // CHECK-SAME: flags: DIFlagPrototyped | DIFlagIntroducedVirtual,<br>
<br>
-// CHECK: !DISubprogram(name: "g",<br>
+// CHECK: ![[g]] = !DISubprogram(name: "g",<br>
 // CHECK-SAME: containingType: ![[Foo]], virtuality: DW_VIRTUALITY_virtual, virtualIndex: 1,<br>
 // CHECK-SAME: flags: DIFlagPrototyped | DIFlagIntroducedVirtual,<br>
<br>
-// CHECK: !DISubprogram(name: "h",<br>
+// CHECK: ![[h]] = !DISubprogram(name: "h",<br>
 // CHECK-SAME: containingType: ![[Foo]], virtuality: DW_VIRTUALITY_virtual, virtualIndex: 2,<br>
 // CHECK-SAME: flags: DIFlagPrototyped | DIFlagIntroducedVirtual,<br>
-<br>
-// CHECK: distinct !DICompositeType(tag: DW_TAG_structure_type, name: "Nested",<br>
-// CHECK-SAME: identifier: ".?AUNested@Foo@@"<br>
<br>
Modified: cfe/trunk/test/Modules/ModuleDebugInfo.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/ModuleDebugInfo.cpp?rev=276317&r1=276316&r2=276317&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/ModuleDebugInfo.cpp?rev=276317&r1=276316&r2=276317&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/test/Modules/ModuleDebugInfo.cpp (original)<br>
+++ cfe/trunk/test/Modules/ModuleDebugInfo.cpp Thu Jul 21 13:43:20 2016<br>
@@ -121,7 +121,7 @@<br>
 // CHECK-SAME:                         flags: DIFlagFwdDecl,<br>
 // CHECK-SAME:                         identifier: "_ZTS9Template1IPvE")<br>
<br>
-// Explicit instatiation.<br>
+// Explicit instantiation.<br>
 // CHECK: !DICompositeType(tag: DW_TAG_class_type, name: "Template1<int>",<br>
 // CHECK-SAME:             templateParams:<br>
 // CHECK-SAME:             identifier: "_ZTS9Template1IiE")<br>
<br>
<br>
_______________________________________________<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/mailman/listinfo/cfe-commits</a><br>
</blockquote></div>