Only emit debug info for implicit members that actually get codegen, not just ODR use.
This includes special members (copy/default ctor, copy assign, default
ctor) and template specializations for member function templates.
Good for a 5% decrease (1.80 to 1.71 GB) in size on Clang+LLVM's .dwo
files (when using fission).
llvm-svn: 188085
diff --git a/clang/test/CodeGenCXX/debug-info-template-member.cpp b/clang/test/CodeGenCXX/debug-info-template-member.cpp
index 6be7f9b..2354a1a 100644
--- a/clang/test/CodeGenCXX/debug-info-template-member.cpp
+++ b/clang/test/CodeGenCXX/debug-info-template-member.cpp
@@ -1,21 +1,19 @@
// RUN: %clang_cc1 -emit-llvm -g -triple x86_64-apple-darwin %s -o - | FileCheck %s
-class MyClass
-{
-public:
- int add2(int j)
- {
- return add<2>(j);
- }
-private:
- template <int i> int add(int j)
- {
- return i + j;
- }
+struct MyClass {
+ template <int i> int add(int j) {
+ return i + j;
+ }
};
-MyClass m;
+int add2(int x) {
+ return MyClass().add<2>(x);
+}
-// CHECK: metadata [[C_MEM:![0-9]*]], i32 0, null, null} ; [ DW_TAG_class_type ] [MyClass]
-// CHECK: [[C_MEM]] = metadata !{metadata {{.*}}, metadata [[C_TEMP:![0-9]*]], metadata {{.*}}}
-// CHECK: [[C_TEMP]] = {{.*}} ; [ DW_TAG_subprogram ] [line 11] [private] [add<2>]
+inline int add3(int x) {
+ return MyClass().add<3>(x); // even though add<3> is ODR used, don't emit it since we don't codegen it
+}
+
+// CHECK: metadata [[C_MEM:![0-9]*]], i32 0, null, null} ; [ DW_TAG_structure_type ] [MyClass]
+// CHECK: [[C_MEM]] = metadata !{metadata [[C_TEMP:![0-9]*]]}
+// CHECK: [[C_TEMP]] = {{.*}} ; [ DW_TAG_subprogram ] [line 4] [add<2>]