Index: lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp =================================================================== --- lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp +++ lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp @@ -174,16 +174,7 @@ } addBlock(*VariableDIE, dwarf::DW_AT_location, Loc); - // Add the linkage name. - StringRef LinkageName = GV.getLinkageName(); - if (!LinkageName.empty()) - // From DWARF4: DIEs to which DW_AT_linkage_name may apply include: - // TAG_common_block, TAG_constant, TAG_entry_point, TAG_subprogram and - // TAG_variable. - addString(*VariableDIE, - DD->getDwarfVersion() >= 4 ? dwarf::DW_AT_linkage_name - : dwarf::DW_AT_MIPS_linkage_name, - GlobalValue::getRealLinkageName(LinkageName)); + addLinkageName(*VariableDIE, GV.getLinkageName()); } else if (const ConstantInt *CI = dyn_cast_or_null(GV.getConstant())) { addConstantValue(*VariableDIE, CI, GTy); Index: lib/CodeGen/AsmPrinter/DwarfUnit.h =================================================================== --- lib/CodeGen/AsmPrinter/DwarfUnit.h +++ lib/CodeGen/AsmPrinter/DwarfUnit.h @@ -251,6 +251,9 @@ void addConstantFPValue(DIE &Die, const MachineOperand &MO); void addConstantFPValue(DIE &Die, const ConstantFP *CFP); + /// \brief Add a linkage name, if it isn't empty. + void addLinkageName(DIE &Die, StringRef LinkageName); + /// addTemplateParams - Add template parameters in buffer. void addTemplateParams(DIE &Buffer, DIArray TParams); Index: lib/CodeGen/AsmPrinter/DwarfUnit.cpp =================================================================== --- lib/CodeGen/AsmPrinter/DwarfUnit.cpp +++ lib/CodeGen/AsmPrinter/DwarfUnit.cpp @@ -757,6 +757,15 @@ addBlock(Die, dwarf::DW_AT_const_value, Block); } +// Add a linkage name to the DIE. +void DwarfUnit::addLinkageName(DIE &Die, StringRef LinkageName) { + if (!LinkageName.empty()) + addString(Die, + DD->getDwarfVersion() >= 4 ? dwarf::DW_AT_linkage_name + : dwarf::DW_AT_MIPS_linkage_name, + GlobalValue::getRealLinkageName(LinkageName)); +} + /// addTemplateParams - Add template parameters into buffer. void DwarfUnit::addTemplateParams(DIE &Buffer, DIArray TParams) { // Add template parameters. @@ -1276,9 +1285,8 @@ assert(((LinkageName.empty() || DeclLinkageName.empty()) || LinkageName == DeclLinkageName) && "decl has a linkage name and it is different"); - if (!LinkageName.empty() && DeclLinkageName.empty()) - addString(SPDie, dwarf::DW_AT_MIPS_linkage_name, - GlobalValue::getRealLinkageName(LinkageName)); + if (DeclLinkageName.empty()) + addLinkageName(SPDie, LinkageName); if (!DeclDie) return false; Index: test/DebugInfo/2010-04-06-NestedFnDbgInfo.ll =================================================================== --- test/DebugInfo/2010-04-06-NestedFnDbgInfo.ll +++ test/DebugInfo/2010-04-06-NestedFnDbgInfo.ll @@ -13,7 +13,7 @@ ; CHECK-NOT: DW_TAG ; CHECK: DW_AT_low_pc ; CHECK-NOT: DW_TAG -; CHECK: DW_AT_MIPS_linkage_name {{.*}} "_ZZN1B2fnEvEN1A3fooEv" +; CHECK: DW_AT_linkage_name {{.*}} "_ZZN1B2fnEvEN1A3fooEv" ; And just double check that there's no out of line definition that references ; this subprogram. ; CHECK-NOT: DW_AT_specification {{.*}} {[[FOO_INL]]} Index: test/DebugInfo/PR20038.ll =================================================================== --- test/DebugInfo/PR20038.ll +++ test/DebugInfo/PR20038.ll @@ -20,7 +20,7 @@ ; CHECK: DW_TAG_subprogram ; CHECK-NOT: DW_TAG -; CHECK: DW_AT_MIPS_linkage_name {{.*}} "_ZN1CD1Ev" +; CHECK: DW_AT_linkage_name {{.*}} "_ZN1CD1Ev" ; CHECK-NOT: {{DW_TAG|NULL}} ; CHECK: DW_TAG_formal_parameter ; CHECK-NOT: DW_TAG Index: test/DebugInfo/X86/DW_AT_specification.ll =================================================================== --- test/DebugInfo/X86/DW_AT_specification.ll +++ test/DebugInfo/X86/DW_AT_specification.ll @@ -4,7 +4,7 @@ ; test that the DW_AT_specification is a back edge in the file. ; CHECK: DW_TAG_subprogram -; CHECK-NEXT: DW_AT_MIPS_linkage_name {{.*}} "_ZN3foo3barEv" +; CHECK-NEXT: DW_AT_linkage_name {{.*}} "_ZN3foo3barEv" ; CHECK: DW_TAG_subprogram ; CHECK-NOT: DW_TAG ; CHECK: DW_AT_specification {{.*}} "_ZN3foo3barEv" Index: test/DebugInfo/X86/arguments.ll =================================================================== --- test/DebugInfo/X86/arguments.ll +++ test/DebugInfo/X86/arguments.ll @@ -16,7 +16,7 @@ ; CHECK: debug_info contents ; CHECK: DW_TAG_subprogram ; CHECK-NOT: DW_TAG -; CHECK: DW_AT_MIPS_linkage_name{{.*}}"_Z4func3fooS_" +; CHECK: DW_AT_linkage_name{{.*}}"_Z4func3fooS_" ; CHECK-NOT: NULL ; CHECK: DW_TAG_formal_parameter ; CHECK-NOT: DW_TAG Index: test/DebugInfo/X86/concrete_out_of_line.ll =================================================================== --- test/DebugInfo/X86/concrete_out_of_line.ll +++ test/DebugInfo/X86/concrete_out_of_line.ll @@ -9,11 +9,11 @@ ; CHECK: DW_TAG_class_type ; CHECK: DW_TAG_subprogram ; CHECK: DW_TAG_subprogram -; CHECK: DW_AT_MIPS_linkage_name {{.*}} "_ZN12nsAutoRefCntaSEi" +; CHECK: DW_AT_linkage_name {{.*}} "_ZN12nsAutoRefCntaSEi" ; CHECK: DW_TAG_class_type ; CHECK: DW_TAG_subprogram -; CHECK: DW_AT_MIPS_linkage_name {{.*}} "_ZN17nsAutoRefCnt7ReleaseEv" +; CHECK: DW_AT_linkage_name {{.*}} "_ZN17nsAutoRefCnt7ReleaseEv" ; CHECK: DW_TAG_subprogram ; CHECK: DW_AT_name {{.*}} "~nsAutoRefCnt" Index: test/DebugInfo/X86/debug-info-static-member.ll =================================================================== --- test/DebugInfo/X86/debug-info-static-member.ll +++ test/DebugInfo/X86/debug-info-static-member.ll @@ -91,7 +91,7 @@ !32 = !MDLocation(line: 22, scope: !5) !33 = !MDFile(filename: "/usr/local/google/home/blaikie/Development/llvm/src/tools/clang/test/CodeGenCXX/debug-info-static-member.cpp", directory: "/home/blaikie/local/Development/llvm/build/clang/x86-64/Debug/llvm") ; PRESENT verifies that static member declarations have these attributes: -; external, declaration, accessibility, and either DW_AT_MIPS_linkage_name +; external, declaration, accessibility, and either DW_AT_linkage_name ; (for variables) or DW_AT_const_value (for constants). ; ; PRESENT: .debug_info contents: Index: test/DebugInfo/X86/debug-loc-offset.ll =================================================================== --- test/DebugInfo/X86/debug-loc-offset.ll +++ test/DebugInfo/X86/debug-loc-offset.ll @@ -41,7 +41,7 @@ ; CHECK: DW_TAG_subprogram ; CHECK-NOT: DW_TAG -; CHECK: DW_AT_MIPS_linkage_name [DW_FORM_strp]{{.*}}"_Z3baz1A" +; CHECK: DW_AT_linkage_name [DW_FORM_strp]{{.*}}"_Z3baz1A" ; CHECK-NOT: {{DW_TAG|NULL}} ; CHECK: DW_TAG_formal_parameter ; CHECK-NOT: DW_TAG Index: test/DebugInfo/X86/gnu-public-names.ll =================================================================== --- test/DebugInfo/X86/gnu-public-names.ll +++ test/DebugInfo/X86/gnu-public-names.ll @@ -59,11 +59,11 @@ ; CHECK-NEXT: DW_AT_name {{.*}} "static_member_variable" ; CHECK: DW_TAG_subprogram -; CHECK-NEXT: DW_AT_MIPS_linkage_name +; CHECK-NEXT: DW_AT_linkage_name ; CHECK-NEXT: DW_AT_name {{.*}} "member_function" ; CHECK: DW_TAG_subprogram -; CHECK-NEXT: DW_AT_MIPS_linkage_name +; CHECK-NEXT: DW_AT_linkage_name ; CHECK-NEXT: DW_AT_name {{.*}} "static_member_function" ; CHECK: [[INT:0x[0-9a-f]+]]: DW_TAG_base_type @@ -92,7 +92,7 @@ ; CHECK: [[GLOB_NS_FUNC:0x[0-9a-f]+]]: DW_TAG_subprogram ; CHECK-NOT: DW_TAG -; CHECK: DW_AT_MIPS_linkage_name +; CHECK: DW_AT_linkage_name ; CHECK-NOT: DW_TAG ; CHECK: DW_AT_name {{.*}} "global_namespace_function" @@ -159,7 +159,7 @@ ; CHECK: [[GLOBAL_FUNC:0x[0-9a-f]+]]: DW_TAG_subprogram ; CHECK-NOT: DW_TAG -; CHECK: DW_AT_MIPS_linkage_name +; CHECK: DW_AT_linkage_name ; CHECK-NOT: DW_TAG ; CHECK: DW_AT_name {{.*}} "global_function" Index: test/DebugInfo/X86/linkage-name.ll =================================================================== --- test/DebugInfo/X86/linkage-name.ll +++ test/DebugInfo/X86/linkage-name.ll @@ -2,7 +2,7 @@ ; RUN: llvm-dwarfdump -debug-dump=info %t | FileCheck %s ; CHECK: DW_TAG_subprogram [9] * -; CHECK-NOT: DW_AT_MIPS_linkage_name +; CHECK-NOT: DW_AT_{{(MIPS_)?}}linkage_name ; CHECK: DW_AT_specification %class.A = type { i8 } Index: test/DebugInfo/X86/pr11300.ll =================================================================== --- test/DebugInfo/X86/pr11300.ll +++ test/DebugInfo/X86/pr11300.ll @@ -7,7 +7,7 @@ ; CHECK: DW_TAG_subprogram ; CHECK: DW_TAG_class_type ; CHECK: DW_TAG_subprogram -; CHECK: DW_AT_MIPS_linkage_name {{.*}} "_ZN3foo3barEv" +; CHECK: DW_AT_linkage_name {{.*}} "_ZN3foo3barEv" ; CHECK: DW_TAG_subprogram ; CHECK-NOT: DW_TAG ; CHECK: DW_AT_specification {{.*}} "_ZN3foo3barEv" Index: test/DebugInfo/namespace_function_definition.ll =================================================================== --- test/DebugInfo/namespace_function_definition.ll +++ test/DebugInfo/namespace_function_definition.ll @@ -14,7 +14,7 @@ ; CHECK-NOT: DW_TAG ; CHECK: DW_AT_low_pc ; CHECK-NOT: DW_TAG -; CHECK: DW_AT_MIPS_linkage_name {{.*}} "_ZN2ns4funcEv" +; CHECK: DW_AT_linkage_name {{.*}} "_ZN2ns4funcEv" ; CHECK: NULL ; CHECK: NULL Index: test/DebugInfo/namespace_inline_function_definition.ll =================================================================== --- test/DebugInfo/namespace_inline_function_definition.ll +++ test/DebugInfo/namespace_inline_function_definition.ll @@ -17,7 +17,7 @@ ; CHECK-NOT: DW_TAG ; CHECK: DW_TAG_subprogram ; CHECK-NOT: DW_TAG -; CHECK: DW_AT_MIPS_linkage_name {{.*}} "_ZN2ns4funcEi" +; CHECK: DW_AT_linkage_name {{.*}} "_ZN2ns4funcEi" ; CHECK-NOT: DW_TAG ; CHECK: DW_TAG_formal_parameter ; CHECK: NULL Index: test/Linker/type-unique-odr-a.ll =================================================================== --- test/Linker/type-unique-odr-a.ll +++ test/Linker/type-unique-odr-a.ll @@ -30,15 +30,15 @@ ; CHECK-NOT: DW_TAG ; CHECK: DW_TAG_subprogram ; CHECK-NOT: DW_TAG -; CHECK: DW_AT_MIPS_linkage_name {{.*}} "_ZN1A6getFooEv" +; CHECK: DW_AT_linkage_name {{.*}} "_ZN1A6getFooEv" ; CHECK-NOT: DW_TAG ; CHECK: DW_AT_name {{.*}} "getFoo" ; CHECK: DW_TAG_subprogram ; CHECK-NOT: DW_TAG -; CHECK: DW_AT_MIPS_linkage_name {{.*}} "_Z3bazv" +; CHECK: DW_AT_linkage_name {{.*}} "_Z3bazv" ; CHECK: DW_TAG_subprogram ; CHECK-NOT: DW_TAG -; CHECK: DW_AT_MIPS_linkage_name {{.*}} "_ZL3barv" +; CHECK: DW_AT_linkage_name {{.*}} "_ZL3barv" ; getFoo and A may only appear once. ; CHECK-NOT: AT_name{{.*(getFoo)|("A")}}