llvm.org GIT mirror llvm / 107918e
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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@231880 91177308-0d34-0410-b5e6-96231b3b80d8 Paul Robinson 5 years ago
16 changed file(s) with 34 addition(s) and 32 deletion(s). Raw diff Collapse all Expand all
173173 }
174174
175175 addBlock(*VariableDIE, dwarf::DW_AT_location, Loc);
176 // Add the linkage name.
177 StringRef LinkageName = GV.getLinkageName();
178 if (!LinkageName.empty())
179 // From DWARF4: DIEs to which DW_AT_linkage_name may apply include:
180 // TAG_common_block, TAG_constant, TAG_entry_point, TAG_subprogram and
181 // TAG_variable.
182 addString(*VariableDIE,
183 DD->getDwarfVersion() >= 4 ? dwarf::DW_AT_linkage_name
184 : dwarf::DW_AT_MIPS_linkage_name,
185 GlobalValue::getRealLinkageName(LinkageName));
176 addLinkageName(*VariableDIE, GV.getLinkageName());
186177 } else if (const ConstantInt *CI =
187178 dyn_cast_or_null(GV.getConstant())) {
188179 addConstantValue(*VariableDIE, CI, GTy);
756756 }
757757
758758 addBlock(Die, dwarf::DW_AT_const_value, Block);
759 }
760
761 // Add a linkage name to the DIE.
762 void DwarfUnit::addLinkageName(DIE &Die, StringRef LinkageName) {
763 if (!LinkageName.empty())
764 addString(Die,
765 DD->getDwarfVersion() >= 4 ? dwarf::DW_AT_linkage_name
766 : dwarf::DW_AT_MIPS_linkage_name,
767 GlobalValue::getRealLinkageName(LinkageName));
759768 }
760769
761770 /// addTemplateParams - Add template parameters into buffer.
12771286 assert(((LinkageName.empty() || DeclLinkageName.empty()) ||
12781287 LinkageName == DeclLinkageName) &&
12791288 "decl has a linkage name and it is different");
1280 if (!LinkageName.empty() && DeclLinkageName.empty())
1281 addString(SPDie, dwarf::DW_AT_MIPS_linkage_name,
1282 GlobalValue::getRealLinkageName(LinkageName));
1289 if (DeclLinkageName.empty())
1290 addLinkageName(SPDie, LinkageName);
12831291
12841292 if (!DeclDie)
12851293 return false;
251251 void addConstantFPValue(DIE &Die, const MachineOperand &MO);
252252 void addConstantFPValue(DIE &Die, const ConstantFP *CFP);
253253
254 /// \brief Add a linkage name, if it isn't empty.
255 void addLinkageName(DIE &Die, StringRef LinkageName);
256
254257 /// addTemplateParams - Add template parameters in buffer.
255258 void addTemplateParams(DIE &Buffer, DIArray TParams);
256259
1212 ; CHECK-NOT: DW_TAG
1313 ; CHECK: DW_AT_low_pc
1414 ; CHECK-NOT: DW_TAG
15 ; CHECK: DW_AT_MIPS_linkage_name {{.*}} "_ZZN1B2fnEvEN1A3fooEv"
15 ; CHECK: DW_AT_linkage_name {{.*}} "_ZZN1B2fnEvEN1A3fooEv"
1616 ; And just double check that there's no out of line definition that references
1717 ; this subprogram.
1818 ; CHECK-NOT: DW_AT_specification {{.*}} {[[FOO_INL]]}
1919
2020 ; CHECK: DW_TAG_subprogram
2121 ; CHECK-NOT: DW_TAG
22 ; CHECK: DW_AT_MIPS_linkage_name {{.*}} "_ZN1CD1Ev"
22 ; CHECK: DW_AT_linkage_name {{.*}} "_ZN1CD1Ev"
2323 ; CHECK-NOT: {{DW_TAG|NULL}}
2424 ; CHECK: DW_TAG_formal_parameter
2525 ; CHECK-NOT: DW_TAG
33 ; test that the DW_AT_specification is a back edge in the file.
44
55 ; CHECK: DW_TAG_subprogram
6 ; CHECK-NEXT: DW_AT_MIPS_linkage_name {{.*}} "_ZN3foo3barEv"
6 ; CHECK-NEXT: DW_AT_linkage_name {{.*}} "_ZN3foo3barEv"
77 ; CHECK: DW_TAG_subprogram
88 ; CHECK-NOT: DW_TAG
99 ; CHECK: DW_AT_specification {{.*}} "_ZN3foo3barEv"
1515 ; CHECK: debug_info contents
1616 ; CHECK: DW_TAG_subprogram
1717 ; CHECK-NOT: DW_TAG
18 ; CHECK: DW_AT_MIPS_linkage_name{{.*}}"_Z4func3fooS_"
18 ; CHECK: DW_AT_linkage_name{{.*}}"_Z4func3fooS_"
1919 ; CHECK-NOT: NULL
2020 ; CHECK: DW_TAG_formal_parameter
2121 ; CHECK-NOT: DW_TAG
88 ; CHECK: DW_TAG_class_type
99 ; CHECK: DW_TAG_subprogram
1010 ; CHECK: DW_TAG_subprogram
11 ; CHECK: DW_AT_MIPS_linkage_name {{.*}} "_ZN12nsAutoRefCntaSEi"
11 ; CHECK: DW_AT_linkage_name {{.*}} "_ZN12nsAutoRefCntaSEi"
1212
1313 ; CHECK: DW_TAG_class_type
1414 ; CHECK: DW_TAG_subprogram
15 ; CHECK: DW_AT_MIPS_linkage_name {{.*}} "_ZN17nsAutoRefCnt7ReleaseEv"
15 ; CHECK: DW_AT_linkage_name {{.*}} "_ZN17nsAutoRefCnt7ReleaseEv"
1616 ; CHECK: DW_TAG_subprogram
1717 ; CHECK: DW_AT_name {{.*}} "~nsAutoRefCnt"
1818
9090 !32 = !MDLocation(line: 22, scope: !5)
9191 !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")
9292 ; PRESENT verifies that static member declarations have these attributes:
93 ; external, declaration, accessibility, and either DW_AT_MIPS_linkage_name
93 ; external, declaration, accessibility, and either DW_AT_linkage_name
9494 ; (for variables) or DW_AT_const_value (for constants).
9595 ;
9696 ; PRESENT: .debug_info contents:
4040
4141 ; CHECK: DW_TAG_subprogram
4242 ; CHECK-NOT: DW_TAG
43 ; CHECK: DW_AT_MIPS_linkage_name [DW_FORM_strp]{{.*}}"_Z3baz1A"
43 ; CHECK: DW_AT_linkage_name [DW_FORM_strp]{{.*}}"_Z3baz1A"
4444 ; CHECK-NOT: {{DW_TAG|NULL}}
4545 ; CHECK: DW_TAG_formal_parameter
4646 ; CHECK-NOT: DW_TAG
5858 ; CHECK-NEXT: DW_AT_name {{.*}} "static_member_variable"
5959
6060 ; CHECK: DW_TAG_subprogram
61 ; CHECK-NEXT: DW_AT_MIPS_linkage_name
61 ; CHECK-NEXT: DW_AT_linkage_name
6262 ; CHECK-NEXT: DW_AT_name {{.*}} "member_function"
6363
6464 ; CHECK: DW_TAG_subprogram
65 ; CHECK-NEXT: DW_AT_MIPS_linkage_name
65 ; CHECK-NEXT: DW_AT_linkage_name
6666 ; CHECK-NEXT: DW_AT_name {{.*}} "static_member_function"
6767
6868 ; CHECK: [[INT:0x[0-9a-f]+]]: DW_TAG_base_type
9191
9292 ; CHECK: [[GLOB_NS_FUNC:0x[0-9a-f]+]]: DW_TAG_subprogram
9393 ; CHECK-NOT: DW_TAG
94 ; CHECK: DW_AT_MIPS_linkage_name
94 ; CHECK: DW_AT_linkage_name
9595 ; CHECK-NOT: DW_TAG
9696 ; CHECK: DW_AT_name {{.*}} "global_namespace_function"
9797
158158
159159 ; CHECK: [[GLOBAL_FUNC:0x[0-9a-f]+]]: DW_TAG_subprogram
160160 ; CHECK-NOT: DW_TAG
161 ; CHECK: DW_AT_MIPS_linkage_name
161 ; CHECK: DW_AT_linkage_name
162162 ; CHECK-NOT: DW_TAG
163163 ; CHECK: DW_AT_name {{.*}} "global_function"
164164
11 ; RUN: llvm-dwarfdump -debug-dump=info %t | FileCheck %s
22
33 ; CHECK: DW_TAG_subprogram [9] *
4 ; CHECK-NOT: DW_AT_MIPS_linkage_name
4 ; CHECK-NOT: DW_AT_{{(MIPS_)?}}linkage_name
55 ; CHECK: DW_AT_specification
66
77 %class.A = type { i8 }
66 ; CHECK: DW_TAG_subprogram
77 ; CHECK: DW_TAG_class_type
88 ; CHECK: DW_TAG_subprogram
9 ; CHECK: DW_AT_MIPS_linkage_name {{.*}} "_ZN3foo3barEv"
9 ; CHECK: DW_AT_linkage_name {{.*}} "_ZN3foo3barEv"
1010 ; CHECK: DW_TAG_subprogram
1111 ; CHECK-NOT: DW_TAG
1212 ; CHECK: DW_AT_specification {{.*}} "_ZN3foo3barEv"
1313 ; CHECK-NOT: DW_TAG
1414 ; CHECK: DW_AT_low_pc
1515 ; CHECK-NOT: DW_TAG
16 ; CHECK: DW_AT_MIPS_linkage_name {{.*}} "_ZN2ns4funcEv"
16 ; CHECK: DW_AT_linkage_name {{.*}} "_ZN2ns4funcEv"
1717 ; CHECK: NULL
1818 ; CHECK: NULL
1919
1616 ; CHECK-NOT: DW_TAG
1717 ; CHECK: DW_TAG_subprogram
1818 ; CHECK-NOT: DW_TAG
19 ; CHECK: DW_AT_MIPS_linkage_name {{.*}} "_ZN2ns4funcEi"
19 ; CHECK: DW_AT_linkage_name {{.*}} "_ZN2ns4funcEi"
2020 ; CHECK-NOT: DW_TAG
2121 ; CHECK: DW_TAG_formal_parameter
2222 ; CHECK: NULL
2929 ; CHECK-NOT: DW_TAG
3030 ; CHECK: DW_TAG_subprogram
3131 ; CHECK-NOT: DW_TAG
32 ; CHECK: DW_AT_MIPS_linkage_name {{.*}} "_ZN1A6getFooEv"
32 ; CHECK: DW_AT_linkage_name {{.*}} "_ZN1A6getFooEv"
3333 ; CHECK-NOT: DW_TAG
3434 ; CHECK: DW_AT_name {{.*}} "getFoo"
3535 ; CHECK: DW_TAG_subprogram
3636 ; CHECK-NOT: DW_TAG
37 ; CHECK: DW_AT_MIPS_linkage_name {{.*}} "_Z3bazv"
37 ; CHECK: DW_AT_linkage_name {{.*}} "_Z3bazv"
3838 ; CHECK: DW_TAG_subprogram
3939 ; CHECK-NOT: DW_TAG
40 ; CHECK: DW_AT_MIPS_linkage_name {{.*}} "_ZL3barv"
40 ; CHECK: DW_AT_linkage_name {{.*}} "_ZL3barv"
4141
4242 ; getFoo and A may only appear once.
4343 ; CHECK-NOT: AT_name{{.*(getFoo)|("A")}}