From fa7745be7a9800519fe0920c058dd331959f6a6e Mon Sep 17 00:00:00 2001 From: Aaron Smith Date: Thu, 11 Apr 2019 20:24:54 +0000 Subject: [PATCH] [DebugInfo] Combine Trivial and NonTrivial flags Summary: These flags are used when emitting debug info and needed to initialize subprogram and member function attributes (function options) for Codeview. These function options are used to create an accurate compiler type for UDT symbols (class/struct/union) from PDBs. The Trivial flag was introduced in https://reviews.llvm.org/D45122 It's been pointed out that Trivial and NonTrivial may imply each other and that seems to be the case in the current tests. This change combines them into a single flag -- NonTrivial -- and updates the corresponding unit tests. There is an additional change to llvm to update the flags. Reviewers: rnk, zturner, dblaikie, probinson, Hui Reviewed By: dblaikie Subscribers: aprantl, jdoerfert, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D59347 llvm-svn: 358219 --- clang/lib/CodeGen/CGDebugInfo.cpp | 6 ++---- .../debug-info-composite-triviality.cpp | 18 ++++++++++++------ 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/clang/lib/CodeGen/CGDebugInfo.cpp b/clang/lib/CodeGen/CGDebugInfo.cpp index a982ef89396e..ff48566af28f 100644 --- a/clang/lib/CodeGen/CGDebugInfo.cpp +++ b/clang/lib/CodeGen/CGDebugInfo.cpp @@ -3034,10 +3034,8 @@ llvm::DICompositeType *CGDebugInfo::CreateLimitedType(const RecordType *Ty) { else Flags |= llvm::DINode::FlagTypePassByValue; - // Record if a C++ record is trivial type. - if (CXXRD->isTrivial()) - Flags |= llvm::DINode::FlagTrivial; - else + // Record if a C++ record is non-trivial type. + if (!CXXRD->isTrivial()) Flags |= llvm::DINode::FlagNonTrivial; } diff --git a/clang/test/CodeGenCXX/debug-info-composite-triviality.cpp b/clang/test/CodeGenCXX/debug-info-composite-triviality.cpp index ba05e6da5f8d..962b82743a88 100644 --- a/clang/test/CodeGenCXX/debug-info-composite-triviality.cpp +++ b/clang/test/CodeGenCXX/debug-info-composite-triviality.cpp @@ -25,34 +25,40 @@ int GlobalVar = 0; // Cases to test composite type's triviality -// CHECK-DAG: !DICompositeType({{.*}}, name: "Union",{{.*}}flags: {{.*}}DIFlagTrivial +// CHECK-DAG: {{.*}}!DIGlobalVariable(name: "Union", +// CHECK-DAG-NEXT: {{^((?!\bDIFlagNonTrivial\b).)*$}} union Union { int a; } Union; -// CHECK-DAG: !DICompositeType({{.*}}, name: "Trivial",{{.*}}flags: {{.*}}DIFlagTrivial +// CHECK-DAG: {{.*}}!DIGlobalVariable(name: "Trivial", +// CHECK-DAG-NEXT: {{^((?!\bDIFlagNonTrivial\b).)*$}} struct Trivial { int i; } Trivial; -// CHECK-DAG: !DICompositeType({{.*}}, name: "TrivialA",{{.*}}flags: {{.*}}DIFlagTrivial +// CHECK-DAG: {{.*}}!DIGlobalVariable(name: "TrivialA", +// CHECK-DAG-NEXT: {{^((?!\bDIFlagNonTrivial\b).)*$}} struct TrivialA { TrivialA() = default; } TrivialA; -// CHECK-DAG: !DICompositeType({{.*}}, name: "TrivialB",{{.*}}flags: {{.*}}DIFlagTrivial +// CHECK-DAG: {{.*}}!DIGlobalVariable(name: "TrivialB", +// CHECK-DAG-NEXT: {{^((?!\bDIFlagNonTrivial\b).)*$}} struct TrivialB { int m; TrivialB(int x) { m = x; } TrivialB() = default; } TrivialB; -// CHECK-DAG: !DICompositeType({{.*}}, name: "TrivialC",{{.*}}flags: {{.*}}DIFlagTrivial +// CHECK-DAG: {{.*}}!DIGlobalVariable(name: "TrivialC", +// CHECK-DAG-NEXT: {{^((?!\bDIFlagNonTrivial\b).)*$}} struct TrivialC { struct Trivial x; } TrivialC; -// CHECK-DAG: !DICompositeType({{.*}}, name: "TrivialD",{{.*}}flags: {{.*}}DIFlagTrivial +// CHECK-DAG: {{.*}}!DIGlobalVariable(name: "TrivialD", +// CHECK-DAG-NEXT: {{^((?!\bDIFlagNonTrivial\b).)*$}} struct NT { NT() {}; };