[DebugInfo] Add option to clang to limit debug info that is emitted for classes.
Summary:
This patch adds an option to limit debug info by only emitting complete class
type information when its constructor is emitted. This applies to classes
that have nontrivial user defined constructors.
I implemented the option by adding another level to `DebugInfoKind`, and
a flag `-flimit-debug-info-constructor`.
Total object file size on Windows, compiling with RelWithDebInfo:
before: 4,257,448 kb
after: 2,104,963 kb
And on Linux
before: 9,225,140 kb
after: 4,387,464 kb
According to the Windows clang.pdb files, here is a list of types that are no
longer complete with this option enabled: https://reviews.llvm.org/P8182
Reviewers: rnk, dblaikie
Subscribers: aprantl, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D72427
2020-01-04 08:28:48 +08:00
|
|
|
// RUN: %clang -cc1 -debug-info-kind=constructor -emit-llvm %s -o - | FileCheck %s
|
|
|
|
|
2020-04-01 04:31:42 +08:00
|
|
|
// CHECK-DAG: !DICompositeType(tag: DW_TAG_structure_type, name: "A"{{.*}}DIFlagTypePassByValue
|
|
|
|
struct A {
|
|
|
|
} TestA;
|
[DebugInfo] Add option to clang to limit debug info that is emitted for classes.
Summary:
This patch adds an option to limit debug info by only emitting complete class
type information when its constructor is emitted. This applies to classes
that have nontrivial user defined constructors.
I implemented the option by adding another level to `DebugInfoKind`, and
a flag `-flimit-debug-info-constructor`.
Total object file size on Windows, compiling with RelWithDebInfo:
before: 4,257,448 kb
after: 2,104,963 kb
And on Linux
before: 9,225,140 kb
after: 4,387,464 kb
According to the Windows clang.pdb files, here is a list of types that are no
longer complete with this option enabled: https://reviews.llvm.org/P8182
Reviewers: rnk, dblaikie
Subscribers: aprantl, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D72427
2020-01-04 08:28:48 +08:00
|
|
|
|
2020-04-01 04:31:42 +08:00
|
|
|
// CHECK-DAG: !DICompositeType(tag: DW_TAG_structure_type, name: "B"{{.*}}flags: DIFlagFwdDecl
|
[DebugInfo] Add option to clang to limit debug info that is emitted for classes.
Summary:
This patch adds an option to limit debug info by only emitting complete class
type information when its constructor is emitted. This applies to classes
that have nontrivial user defined constructors.
I implemented the option by adding another level to `DebugInfoKind`, and
a flag `-flimit-debug-info-constructor`.
Total object file size on Windows, compiling with RelWithDebInfo:
before: 4,257,448 kb
after: 2,104,963 kb
And on Linux
before: 9,225,140 kb
after: 4,387,464 kb
According to the Windows clang.pdb files, here is a list of types that are no
longer complete with this option enabled: https://reviews.llvm.org/P8182
Reviewers: rnk, dblaikie
Subscribers: aprantl, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D72427
2020-01-04 08:28:48 +08:00
|
|
|
struct B {
|
|
|
|
B();
|
2020-04-01 04:31:42 +08:00
|
|
|
} TestB;
|
[DebugInfo] Add option to clang to limit debug info that is emitted for classes.
Summary:
This patch adds an option to limit debug info by only emitting complete class
type information when its constructor is emitted. This applies to classes
that have nontrivial user defined constructors.
I implemented the option by adding another level to `DebugInfoKind`, and
a flag `-flimit-debug-info-constructor`.
Total object file size on Windows, compiling with RelWithDebInfo:
before: 4,257,448 kb
after: 2,104,963 kb
And on Linux
before: 9,225,140 kb
after: 4,387,464 kb
According to the Windows clang.pdb files, here is a list of types that are no
longer complete with this option enabled: https://reviews.llvm.org/P8182
Reviewers: rnk, dblaikie
Subscribers: aprantl, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D72427
2020-01-04 08:28:48 +08:00
|
|
|
|
2020-09-30 07:19:08 +08:00
|
|
|
// CHECK-DAG: ![[C:[0-9]+]] = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "C"{{.*}}DIFlagTypePassByValue
|
[DebugInfo] Add option to clang to limit debug info that is emitted for classes.
Summary:
This patch adds an option to limit debug info by only emitting complete class
type information when its constructor is emitted. This applies to classes
that have nontrivial user defined constructors.
I implemented the option by adding another level to `DebugInfoKind`, and
a flag `-flimit-debug-info-constructor`.
Total object file size on Windows, compiling with RelWithDebInfo:
before: 4,257,448 kb
after: 2,104,963 kb
And on Linux
before: 9,225,140 kb
after: 4,387,464 kb
According to the Windows clang.pdb files, here is a list of types that are no
longer complete with this option enabled: https://reviews.llvm.org/P8182
Reviewers: rnk, dblaikie
Subscribers: aprantl, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D72427
2020-01-04 08:28:48 +08:00
|
|
|
struct C {
|
|
|
|
C() {}
|
2020-04-01 04:31:42 +08:00
|
|
|
} TestC;
|
[DebugInfo] Add option to clang to limit debug info that is emitted for classes.
Summary:
This patch adds an option to limit debug info by only emitting complete class
type information when its constructor is emitted. This applies to classes
that have nontrivial user defined constructors.
I implemented the option by adding another level to `DebugInfoKind`, and
a flag `-flimit-debug-info-constructor`.
Total object file size on Windows, compiling with RelWithDebInfo:
before: 4,257,448 kb
after: 2,104,963 kb
And on Linux
before: 9,225,140 kb
after: 4,387,464 kb
According to the Windows clang.pdb files, here is a list of types that are no
longer complete with this option enabled: https://reviews.llvm.org/P8182
Reviewers: rnk, dblaikie
Subscribers: aprantl, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D72427
2020-01-04 08:28:48 +08:00
|
|
|
|
2020-04-01 04:31:42 +08:00
|
|
|
// CHECK-DAG: !DICompositeType(tag: DW_TAG_structure_type, name: "D"{{.*}}DIFlagTypePassByValue
|
[DebugInfo] Add option to clang to limit debug info that is emitted for classes.
Summary:
This patch adds an option to limit debug info by only emitting complete class
type information when its constructor is emitted. This applies to classes
that have nontrivial user defined constructors.
I implemented the option by adding another level to `DebugInfoKind`, and
a flag `-flimit-debug-info-constructor`.
Total object file size on Windows, compiling with RelWithDebInfo:
before: 4,257,448 kb
after: 2,104,963 kb
And on Linux
before: 9,225,140 kb
after: 4,387,464 kb
According to the Windows clang.pdb files, here is a list of types that are no
longer complete with this option enabled: https://reviews.llvm.org/P8182
Reviewers: rnk, dblaikie
Subscribers: aprantl, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D72427
2020-01-04 08:28:48 +08:00
|
|
|
struct D {
|
|
|
|
D();
|
|
|
|
};
|
|
|
|
D::D() {}
|
2020-04-01 04:31:42 +08:00
|
|
|
|
2020-09-17 00:58:39 +08:00
|
|
|
// Test for constexpr constructor.
|
2020-04-01 04:31:42 +08:00
|
|
|
// CHECK-DAG: !DICompositeType(tag: DW_TAG_structure_type, name: "E"{{.*}}DIFlagTypePassByValue
|
|
|
|
struct E {
|
|
|
|
constexpr E(){};
|
|
|
|
} TestE;
|
2020-07-30 10:54:08 +08:00
|
|
|
|
2020-09-17 00:58:39 +08:00
|
|
|
// Test for trivial constructor.
|
2020-07-30 10:54:08 +08:00
|
|
|
// CHECK-DAG: !DICompositeType(tag: DW_TAG_structure_type, name: "F"{{.*}}DIFlagTypePassByValue
|
|
|
|
struct F {
|
|
|
|
F() = default;
|
|
|
|
F(int) {}
|
|
|
|
int i;
|
|
|
|
} TestF;
|
2020-09-17 00:58:39 +08:00
|
|
|
|
|
|
|
// Test for trivial constructor.
|
|
|
|
// CHECK-DAG: ![[G:.*]] ={{.*}}!DICompositeType({{.*}}name: "G"{{.*}}DIFlagTypePassByValue
|
|
|
|
// CHECK-DAG: !DICompositeType({{.*}}scope: ![[G]], {{.*}}DIFlagTypePassByValue
|
|
|
|
struct G {
|
|
|
|
G() : g_(0) {}
|
|
|
|
struct {
|
|
|
|
int g_;
|
|
|
|
};
|
|
|
|
} TestG;
|
|
|
|
|
|
|
|
// Test for an aggregate class with an implicit non-trivial default constructor
|
|
|
|
// that is not instantiated.
|
|
|
|
// CHECK-DAG: !DICompositeType({{.*}}name: "H",{{.*}}DIFlagTypePassByValue
|
|
|
|
struct H {
|
|
|
|
B b;
|
|
|
|
};
|
|
|
|
void f(H h) {}
|
|
|
|
|
|
|
|
// Test for an aggregate class with an implicit non-trivial default constructor
|
|
|
|
// that is instantiated.
|
|
|
|
// CHECK-DAG: !DICompositeType({{.*}}name: "J",{{.*}}DIFlagTypePassByValue
|
|
|
|
struct J {
|
|
|
|
B b;
|
|
|
|
};
|
|
|
|
void f(decltype(J()) j) {}
|
|
|
|
|
|
|
|
// Test for a class with trivial default constructor that is not instantiated.
|
|
|
|
// CHECK-DAG: !DICompositeType({{.*}}name: "K",{{.*}}DIFlagTypePassByValue
|
|
|
|
class K {
|
|
|
|
int i;
|
|
|
|
};
|
|
|
|
void f(K k) {}
|
|
|
|
|
|
|
|
// Test that we don't use constructor homing on lambdas.
|
|
|
|
// CHECK-DAG: ![[L:.*]] ={{.*}}!DISubprogram({{.*}}name: "L"
|
|
|
|
// CHECK-DAG: !DICompositeType({{.*}}scope: ![[L]], {{.*}}DIFlagTypePassByValue
|
|
|
|
void L() {
|
|
|
|
auto func = [&]() {};
|
|
|
|
}
|
2020-09-30 07:19:08 +08:00
|
|
|
|
|
|
|
// Check that types are being added to retained types list.
|
|
|
|
// CHECK-DAG: !DICompileUnit{{.*}}retainedTypes: ![[RETAINED:[0-9]+]]
|
|
|
|
// CHECK-DAG: ![[RETAINED]] = {{.*}}![[C]]
|