brintos

brintos / llvm-project-archived public Read only

0
0
Text · 4.2 KiB · 9a911c7 Raw
111 lines · plain
1; REQUIRES: object-emission2;3; RUN: llvm-link %s %p/type-unique-odr-b.ll -S -o - \4; RUN:   | %llc_dwarf -dwarf-linkage-names=All -filetype=obj -O0 \5; RUN:   | llvm-dwarfdump -debug-info - \6; RUN:   | FileCheck %s7; RUN: llvm-link %p/type-unique-odr-b.ll %s -S -o - \8; RUN:   | %llc_dwarf -dwarf-linkage-names=All -filetype=obj -O0 \9; RUN:   | llvm-dwarfdump -debug-info - \10; RUN:   | FileCheck %s11;12; Test ODR-based type uniquing for C++ class members.13; rdar://problem/15851313.14;15; $ cat -n type-unique-odr-a.cpp16;     1	class A {17;     2	  int data;18;     3	protected:19;     4	  void getFoo();20;     5	};21;     622;     7	static void bar() {23;     8	  A a;24;     9	}25;    1026;    11	void baz() { bar(); }27;; #include "ab.h"28; foo_t bar() {29;     return A().getFoo();30; }31;32; CHECK:      DW_TAG_class_type33; CHECK-NEXT:   DW_AT_name ("A")34; CHECK-NOT:    DW_TAG35; CHECK:        DW_TAG_member36; CHECK-NEXT:     DW_AT_name ("data")37; CHECK-NOT:    DW_TAG38; CHECK:        DW_TAG_subprogram39; CHECK-NOT:    DW_TAG40; CHECK:          DW_AT_linkage_name ("_ZN1A6getFooEv")41; CHECK-NOT:    DW_TAG42; CHECK:          DW_AT_name ("getFoo")43 44; Ensure that there aren't any other subprograms in class A.45; CHECK-NOT:      DW_TAG46; CHECK:          DW_TAG_formal_parameter47; CHECK-NOT:      DW_TAG48; CHECK:          NULL49; CHECK-NOT:    DW_TAG50; CHECK:        NULL51; CHECK-NOT:  DW_TAG52; CHECK:      DW_TAG_base_type53 54; Ensure that getFoo and A are only emitted once.55; CHECK-NOT:  AT_name{{.*(getFoo)|("A")}}56 57; ModuleID = 'type-unique-odr-a.cpp'58 59%class.A = type { i32 }60 61; Function Attrs: nounwind62define void @_Z3bazv() #0 !dbg !15 {63entry:64  call void @_ZL3barv(), !dbg !2365  ret void, !dbg !2366}67 68; Function Attrs: nounwind69define internal void @_ZL3barv() #0 !dbg !19 {70entry:71  %a = alloca %class.A, align 472  call void @llvm.dbg.declare(metadata ptr %a, metadata !24, metadata !DIExpression()), !dbg !2573  ret void, !dbg !2674}75 76; Function Attrs: nounwind readnone77declare void @llvm.dbg.declare(metadata, metadata, metadata) #178 79attributes #0 = { nounwind }80attributes #1 = { nounwind readnone }81 82!llvm.dbg.cu = !{!0}83!llvm.module.flags = !{!20, !21}84!llvm.ident = !{!22}85 86!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, producer: "clang version 3.5.0 ", isOptimized: false, emissionKind: FullDebug, file: !1, enums: !2, retainedTypes: !3, globals: !2, imports: !2)87!1 = !DIFile(filename: "<unknown>", directory: "")88!2 = !{}89!3 = !{!4}90!4 = !DICompositeType(tag: DW_TAG_class_type, name: "A", line: 1, size: 32, align: 32, file: !5, elements: !6, identifier: "_ZTS1A")91!5 = !DIFile(filename: "type-unique-odr-a.cpp", directory: "")92!6 = !{!7, !9}93!7 = !DIDerivedType(tag: DW_TAG_member, name: "data", line: 2, size: 32, align: 32, flags: DIFlagPrivate, file: !5, scope: !4, baseType: !8)94!8 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed)95!9 = !DISubprogram(name: "getFoo", linkageName: "_ZN1A6getFooEv", line: 4, isLocal: false, isDefinition: false, virtualIndex: 6, flags: DIFlagProtected | DIFlagPrototyped, isOptimized: false, scopeLine: 4, file: !5, scope: !4, type: !10)96!10 = !DISubroutineType(types: !11)97!11 = !{null, !12}98!12 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, flags: DIFlagArtificial | DIFlagObjectPointer, baseType: !4)99!15 = distinct !DISubprogram(name: "baz", linkageName: "_Z3bazv", line: 11, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, unit: !0, scopeLine: 11, file: !5, scope: !16, type: !17, retainedNodes: !2)100!16 = !DIFile(filename: "type-unique-odr-a.cpp", directory: "")101!17 = !DISubroutineType(types: !18)102!18 = !{null}103!19 = distinct !DISubprogram(name: "bar", linkageName: "_ZL3barv", line: 7, isLocal: true, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, unit: !0, scopeLine: 7, file: !5, scope: !16, type: !17, retainedNodes: !2)104!20 = !{i32 2, !"Dwarf Version", i32 4}105!21 = !{i32 1, !"Debug Info Version", i32 3}106!22 = !{!"clang version 3.5.0 "}107!23 = !DILocation(line: 11, scope: !15)108!24 = !DILocalVariable(name: "a", line: 8, scope: !19, file: !16, type: !4)109!25 = !DILocation(line: 8, scope: !19)110!26 = !DILocation(line: 9, scope: !19)111