r219100 - DebugInfo: Don't include member function template specializations in the list of class members
David Blaikie
dblaikie at gmail.com
Sun Oct 5 22:06:54 PDT 2014
Author: dblaikie
Date: Mon Oct 6 00:06:54 2014
New Revision: 219100
URL: http://llvm.org/viewvc/llvm-project?rev=219100&view=rev
Log:
DebugInfo: Don't include member function template specializations in the list of class members
By leaving these members out of the member list, we avoid them being
emitted into type unit definitions - while still allowing the
definition/declaration to be injected into the compile unit as expected.
Modified:
cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
cfe/trunk/test/CodeGenCXX/debug-info-template-member.cpp
Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=219100&r1=219099&r2=219100&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Mon Oct 6 00:06:54 2014
@@ -1174,16 +1174,6 @@ CollectCXXMemberFunctions(const CXXRecor
EltTys.push_back(CreateCXXMemberFunction(Method, Unit, RecordTy));
} else
EltTys.push_back(MI->second);
- } else if (const auto *FTD = dyn_cast<FunctionTemplateDecl>(I)) {
- // Add any template specializations that have already been seen. Like
- // implicit member functions, these may have been added to a declaration
- // in the case of vtable-based debug info reduction.
- for (const auto *SI : FTD->specializations()) {
- llvm::DenseMap<const FunctionDecl *, llvm::WeakVH>::iterator MI =
- SPCache.find(cast<CXXMethodDecl>(SI)->getCanonicalDecl());
- if (MI != SPCache.end())
- EltTys.push_back(MI->second);
- }
}
}
}
Modified: cfe/trunk/test/CodeGenCXX/debug-info-template-member.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/debug-info-template-member.cpp?rev=219100&r1=219099&r2=219100&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenCXX/debug-info-template-member.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/debug-info-template-member.cpp Mon Oct 6 00:06:54 2014
@@ -28,10 +28,9 @@ inline int add3(int x) {
// CHECK: [[VIRT_T]] = metadata !{metadata !"0x2f\00T\000\000"{{, [^,]+}}, metadata !"_ZTS4elem", {{.*}} ; [ DW_TAG_template_type_parameter ]
// CHECK: [[C:![0-9]*]] = {{.*}}, metadata [[C_MEM:![0-9]*]], metadata !"_ZTS7MyClass", null, metadata !"_ZTS7MyClass"} ; [ DW_TAG_structure_type ] [MyClass]
-// CHECK: [[C_MEM]] = metadata !{metadata [[C_VPTR:![0-9]*]], metadata [[C_ADD:![0-9]*]], metadata [[C_FUNC:![0-9]*]], metadata [[C_CTOR:![0-9]*]]}
+// CHECK: [[C_MEM]] = metadata !{metadata [[C_VPTR:![0-9]*]], metadata [[C_FUNC:![0-9]*]], metadata [[C_CTOR:![0-9]*]]}
// CHECK: [[C_VPTR]] = {{.*}} ; [ DW_TAG_member ] [_vptr$MyClass]
-// CHECK: [[C_ADD]] = {{.*}} ; [ DW_TAG_subprogram ] [line 4] [add<2>]
// CHECK: [[C_FUNC]] = {{.*}} ; [ DW_TAG_subprogram ] [line 7] [func]
// CHECK: [[C_CTOR]] = {{.*}} ; [ DW_TAG_subprogram ] [line 0] [MyClass]
@@ -39,6 +38,12 @@ inline int add3(int x) {
// CHECK: [[ELEM_MEM]] = metadata !{metadata [[ELEM_X:![0-9]*]]}
// CHECK: [[ELEM_X]] = {{.*}} ; [ DW_TAG_member ] [x] {{.*}} [static] [from _ZTS4virtI4elemE]
+// Check that the member function template specialization refers to its class by
+// scope, even though it didn't appear in the class's member list (C_MEM). This
+// prevents the function from being added to type units, while still appearing
+// in the type declaration/reference in the compile unit.
+// CHECK: metadata !"_ZTS7MyClass", {{.*}} ; [ DW_TAG_subprogram ] [line 4] [add<2>]
+
template<typename T>
struct outer {
struct inner {
More information about the cfe-commits
mailing list