r276317 - Reroll "Include unreferenced nested types in member list only for CodeView"

David Blaikie via cfe-commits cfe-commits at lists.llvm.org
Mon Jul 25 09:03:53 PDT 2016


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)

On Thu, Jul 21, 2016 at 11:50 AM Adrian McCarthy via cfe-commits <
cfe-commits at lists.llvm.org> wrote:

> Author: amccarth
> Date: Thu Jul 21 13:43:20 2016
> New Revision: 276317
>
> URL: http://llvm.org/viewvc/llvm-project?rev=276317&view=rev
> Log:
> Reroll "Include unreferenced nested types in member list only for CodeView"
>
> Another attempt at r276271, hopefully without breaking ModuleDebugInfo
> test.
>
> Modified:
>     cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
>     cfe/trunk/lib/CodeGen/CGDebugInfo.h
>     cfe/trunk/test/CodeGenCXX/debug-info-dup-fwd-decl.cpp
>     cfe/trunk/test/CodeGenCXX/debug-info-ms-abi.cpp
>     cfe/trunk/test/Modules/ModuleDebugInfo.cpp
>
> Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=276317&r1=276316&r2=276317&view=diff
>
> ==============================================================================
> --- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original)
> +++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Thu Jul 21 13:43:20 2016
> @@ -1090,6 +1090,14 @@ void CGDebugInfo::CollectRecordNormalFie
>    elements.push_back(FieldType);
>  }
>
> +void CGDebugInfo::CollectRecordNestedRecord(
> +    const RecordDecl *RD, SmallVectorImpl<llvm::Metadata *> &elements) {
> +  QualType Ty = CGM.getContext().getTypeDeclType(RD);
> +  SourceLocation Loc = RD->getLocation();
> +  llvm::DIType *nestedType = getOrCreateType(Ty, getOrCreateFile(Loc));
> +  elements.push_back(nestedType);
> +}
> +
>  void CGDebugInfo::CollectRecordFields(
>      const RecordDecl *record, llvm::DIFile *tunit,
>      SmallVectorImpl<llvm::Metadata *> &elements,
> @@ -1101,6 +1109,10 @@ void CGDebugInfo::CollectRecordFields(
>    else {
>      const ASTRecordLayout &layout =
> CGM.getContext().getASTRecordLayout(record);
>
> +    // Debug info for nested records is included in the member list only
> for
> +    // CodeView.
> +    bool IncludeNestedRecords = CGM.getCodeGenOpts().EmitCodeView;
> +
>      // Field number for non-static fields.
>      unsigned fieldNo = 0;
>
> @@ -1126,7 +1138,10 @@ void CGDebugInfo::CollectRecordFields(
>
>          // Bump field number for next field.
>          ++fieldNo;
> -      }
> +      } else if (const auto *nestedRec = dyn_cast<CXXRecordDecl>(I))
> +        if (IncludeNestedRecords && !nestedRec->isImplicit() &&
> +            nestedRec->getDeclContext() == record)
> +          CollectRecordNestedRecord(nestedRec, elements);
>    }
>  }
>
> @@ -3620,8 +3635,8 @@ void CGDebugInfo::EmitUsingDirective(con
>    if (CGM.getCodeGenOpts().getDebugInfo() <
> codegenoptions::LimitedDebugInfo)
>      return;
>    const NamespaceDecl *NSDecl = UD.getNominatedNamespace();
> -  if (!NSDecl->isAnonymousNamespace() ||
> -      CGM.getCodeGenOpts().DebugExplicitImport) {
> +  if (!NSDecl->isAnonymousNamespace() ||
> +      CGM.getCodeGenOpts().DebugExplicitImport) {
>      DBuilder.createImportedModule(
>          getCurrentContextDescriptor(cast<Decl>(UD.getDeclContext())),
>          getOrCreateNameSpace(NSDecl),
>
> Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.h
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.h?rev=276317&r1=276316&r2=276317&view=diff
>
> ==============================================================================
> --- cfe/trunk/lib/CodeGen/CGDebugInfo.h (original)
> +++ cfe/trunk/lib/CodeGen/CGDebugInfo.h Thu Jul 21 13:43:20 2016
> @@ -254,6 +254,8 @@ class CGDebugInfo {
>                                  llvm::DIFile *F,
>                                  SmallVectorImpl<llvm::Metadata *> &E,
>                                  llvm::DIType *RecordTy, const RecordDecl
> *RD);
> +  void CollectRecordNestedRecord(const RecordDecl *RD,
> +                                 SmallVectorImpl<llvm::Metadata *> &E);
>    void CollectRecordFields(const RecordDecl *Decl, llvm::DIFile *F,
>                             SmallVectorImpl<llvm::Metadata *> &E,
>                             llvm::DICompositeType *RecordTy);
>
> Modified: cfe/trunk/test/CodeGenCXX/debug-info-dup-fwd-decl.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/debug-info-dup-fwd-decl.cpp?rev=276317&r1=276316&r2=276317&view=diff
>
> ==============================================================================
> --- cfe/trunk/test/CodeGenCXX/debug-info-dup-fwd-decl.cpp (original)
> +++ cfe/trunk/test/CodeGenCXX/debug-info-dup-fwd-decl.cpp Thu Jul 21
> 13:43:20 2016
> @@ -19,6 +19,6 @@ protected:
>
>  Test t;
>
> -// CHECK: !DIDerivedType(tag: DW_TAG_pointer_type
>  // CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "data"
> +// CHECK: !DIDerivedType(tag: DW_TAG_pointer_type
>  // CHECK-NOT: !DICompositeType(tag: DW_TAG_structure_type, name: "data"
>
> Modified: cfe/trunk/test/CodeGenCXX/debug-info-ms-abi.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/debug-info-ms-abi.cpp?rev=276317&r1=276316&r2=276317&view=diff
>
> ==============================================================================
> --- cfe/trunk/test/CodeGenCXX/debug-info-ms-abi.cpp (original)
> +++ cfe/trunk/test/CodeGenCXX/debug-info-ms-abi.cpp Thu Jul 21 13:43:20
> 2016
> @@ -1,4 +1,4 @@
> -// RUN: %clang_cc1 %s -triple=i686-pc-windows-msvc
> -debug-info-kind=limited -emit-llvm -o - | FileCheck %s
> +// RUN: %clang_cc1 %s -triple=i686-pc-windows-msvc
> -debug-info-kind=limited -gcodeview -emit-llvm -o - | FileCheck %s
>
>  // Tests that certain miscellaneous features work in the MS ABI.
>
> @@ -12,19 +12,22 @@ Foo f;
>  Foo::Nested n;
>
>  // CHECK: ![[Foo:[^ ]*]] = distinct !DICompositeType(tag:
> DW_TAG_structure_type, name: "Foo",
> +// CHECK-SAME: elements: ![[elements:[0-9]+]]
>  // CHECK-SAME: identifier: ".?AUFoo@@"
>
> -// CHECK: !DISubprogram(name: "f",
> +// CHECK: ![[elements]] = !{![[vptr:[0-9]+]], ![[Nested:[0-9]+]],
> ![[f:[0-9]+]], ![[g:[0-9]+]], ![[h:[0-9]+]]}
> +
> +// CHECK: ![[Nested]] = distinct !DICompositeType(tag:
> DW_TAG_structure_type, name: "Nested",
> +// CHECK-SAME: identifier: ".?AUNested at Foo@@"
> +
> +// CHECK: ![[f]] = !DISubprogram(name: "f",
>  // CHECK-SAME: containingType: ![[Foo]], virtuality:
> DW_VIRTUALITY_virtual, virtualIndex: 0,
>  // CHECK-SAME: flags: DIFlagPrototyped | DIFlagIntroducedVirtual,
>
> -// CHECK: !DISubprogram(name: "g",
> +// CHECK: ![[g]] = !DISubprogram(name: "g",
>  // CHECK-SAME: containingType: ![[Foo]], virtuality:
> DW_VIRTUALITY_virtual, virtualIndex: 1,
>  // CHECK-SAME: flags: DIFlagPrototyped | DIFlagIntroducedVirtual,
>
> -// CHECK: !DISubprogram(name: "h",
> +// CHECK: ![[h]] = !DISubprogram(name: "h",
>  // CHECK-SAME: containingType: ![[Foo]], virtuality:
> DW_VIRTUALITY_virtual, virtualIndex: 2,
>  // CHECK-SAME: flags: DIFlagPrototyped | DIFlagIntroducedVirtual,
> -
> -// CHECK: distinct !DICompositeType(tag: DW_TAG_structure_type, name:
> "Nested",
> -// CHECK-SAME: identifier: ".?AUNested at Foo@@"
>
> Modified: cfe/trunk/test/Modules/ModuleDebugInfo.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/ModuleDebugInfo.cpp?rev=276317&r1=276316&r2=276317&view=diff
>
> ==============================================================================
> --- cfe/trunk/test/Modules/ModuleDebugInfo.cpp (original)
> +++ cfe/trunk/test/Modules/ModuleDebugInfo.cpp Thu Jul 21 13:43:20 2016
> @@ -121,7 +121,7 @@
>  // CHECK-SAME:                         flags: DIFlagFwdDecl,
>  // CHECK-SAME:                         identifier: "_ZTS9Template1IPvE")
>
> -// Explicit instatiation.
> +// Explicit instantiation.
>  // CHECK: !DICompositeType(tag: DW_TAG_class_type, name: "Template1<int>",
>  // CHECK-SAME:             templateParams:
>  // CHECK-SAME:             identifier: "_ZTS9Template1IiE")
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160725/a8929c58/attachment-0001.html>


More information about the cfe-commits mailing list