[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
This commit is contained in:
Aaron Smith 2019-04-11 20:24:54 +00:00
parent 68a5d619a4
commit fa7745be7a
2 changed files with 14 additions and 10 deletions

View File

@ -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;
}

View File

@ -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() {};
};