[PATCH] D59347: [DebugInfo] Combine Trivial and NonTrivial flags
Aaron Smith via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Mar 13 22:22:48 PDT 2019
asmith created this revision.
asmith added reviewers: rnk, zturner, dblaikie, probinson.
Herald added subscribers: cfe-commits, jdoerfert, aprantl.
Herald added a project: clang.
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.
Repository:
rC Clang
https://reviews.llvm.org/D59347
Files:
lib/CodeGen/CGDebugInfo.cpp
test/CodeGenCXX/debug-info-composite-triviality.cpp
Index: test/CodeGenCXX/debug-info-composite-triviality.cpp
===================================================================
--- test/CodeGenCXX/debug-info-composite-triviality.cpp
+++ test/CodeGenCXX/debug-info-composite-triviality.cpp
@@ -23,44 +23,6 @@
// CHECK-DAG: !DIGlobalVariable(name: "GlobalVar", {{.*}}type: {{.*}}, isLocal: false, isDefinition: true)
int GlobalVar = 0;
-// Cases to test composite type's triviality
-
-// CHECK-DAG: !DICompositeType({{.*}}, name: "Union",{{.*}}flags: {{.*}}DIFlagTrivial
-union Union {
- int a;
-} Union;
-
-// CHECK-DAG: !DICompositeType({{.*}}, name: "Trivial",{{.*}}flags: {{.*}}DIFlagTrivial
-struct Trivial {
- int i;
-} Trivial;
-
-// CHECK-DAG: !DICompositeType({{.*}}, name: "TrivialA",{{.*}}flags: {{.*}}DIFlagTrivial
-struct TrivialA {
- TrivialA() = default;
-} TrivialA;
-
-// CHECK-DAG: !DICompositeType({{.*}}, name: "TrivialB",{{.*}}flags: {{.*}}DIFlagTrivial
-struct TrivialB {
- int m;
- TrivialB(int x) { m = x; }
- TrivialB() = default;
-} TrivialB;
-
-// CHECK-DAG: !DICompositeType({{.*}}, name: "TrivialC",{{.*}}flags: {{.*}}DIFlagTrivial
-struct TrivialC {
- struct Trivial x;
-} TrivialC;
-
-// CHECK-DAG: !DICompositeType({{.*}}, name: "TrivialD",{{.*}}flags: {{.*}}DIFlagTrivial
-struct NT {
- NT() {};
-};
-struct TrivialD {
- static struct NT x; // Member is non-trivial but is static.
-} TrivialD;
-
-
// CHECK-DAG: !DICompositeType({{.*}}, name: "NonTrivial",{{.*}}flags: {{.*}}DIFlagNonTrivial
struct NonTrivial {
NonTrivial() {}
@@ -84,7 +46,3 @@
// CHECK-DAG: !DICompositeType({{.*}}, name: "NonTrivialD",{{.*}}flags: {{.*}}DIFlagNonTrivial
struct NonTrivialD : NonTrivial {
} NonTrivialD;
-
-// CHECK-DAG: !DICompositeType({{.*}}, name: "NonTrivialE",{{.*}}flags: {{.*}}DIFlagNonTrivial
-struct NonTrivialE : Trivial, NonTrivial {
-} NonTrivialE;
Index: lib/CodeGen/CGDebugInfo.cpp
===================================================================
--- lib/CodeGen/CGDebugInfo.cpp
+++ lib/CodeGen/CGDebugInfo.cpp
@@ -3034,10 +3034,8 @@
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;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D59347.190560.patch
Type: text/x-patch
Size: 2368 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190314/0c2a99b3/attachment.bin>
More information about the cfe-commits
mailing list