mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-12-15 07:39:31 +00:00
Emit correct linkage-name attribute based on DWARF version.
There are still 4 tests that check for DW_AT_MIPS_linkage_name, because they specify DWARF 2 or 3 in the module metadata. So, I didn't create an explicit version-based test for the attribute. Differential Revision: http://reviews.llvm.org/D8227 llvm-svn: 231880
This commit is contained in:
parent
6b5f658b6c
commit
ff7c900586
@ -174,16 +174,7 @@ DIE *DwarfCompileUnit::getOrCreateGlobalVariableDIE(DIGlobalVariable GV) {
|
||||
}
|
||||
|
||||
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<ConstantInt>(GV.getConstant())) {
|
||||
addConstantValue(*VariableDIE, CI, GTy);
|
||||
|
@ -759,6 +759,15 @@ void DwarfUnit::addConstantValue(DIE &Die, const APInt &Val, bool Unsigned) {
|
||||
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.
|
||||
@ -1278,9 +1287,8 @@ bool DwarfUnit::applySubprogramDefinitionAttributes(DISubprogram SP,
|
||||
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;
|
||||
|
@ -252,6 +252,9 @@ public:
|
||||
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);
|
||||
|
||||
|
@ -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]]}
|
||||
|
@ -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
|
||||
|
@ -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"
|
||||
|
@ -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
|
||||
|
@ -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"
|
||||
|
||||
|
@ -91,7 +91,7 @@ declare void @llvm.dbg.declare(metadata, metadata, metadata) nounwind readnone
|
||||
!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:
|
||||
|
@ -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
|
||||
|
@ -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"
|
||||
|
||||
|
@ -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 }
|
||||
|
@ -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"
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
@ -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")}}
|
||||
|
Loading…
Reference in New Issue
Block a user