Home | History | Annotate | Download | only in Linker
      1 ; RUN: true
      2 ; This file belongs to type-unique-odr-a.ll.
      3 ;
      4 ; Test ODR-based type uniquing for C++ class members.
      5 ; rdar://problem/15851313.
      6 ;
      7 ; $ cat -n type-unique-odr-b.cpp
      8 ;     1	// Make this declaration start on a different line.
      9 ;     2	class A {
     10 ;     3	  int data;
     11 ;     4	protected:
     12 ;     5	  void getFoo();
     13 ;     6	};
     14 ;     7
     15 ;     8	void A::getFoo() {}
     16 ;     9
     17 ;    10	static void bar() {}
     18 ;    11	void f() { bar(); };
     19 
     20 ; ModuleID = 'type-unique-odr-b.cpp'
     21 
     22 %class.A = type { i32 }
     23 
     24 ; Function Attrs: nounwind
     25 define void @_ZN1A6getFooEv(%class.A* %this) #0 align 2 {
     26 entry:
     27   %this.addr = alloca %class.A*, align 8
     28   store %class.A* %this, %class.A** %this.addr, align 8
     29   call void @llvm.dbg.declare(metadata !{%class.A** %this.addr}, metadata !24), !dbg !26
     30   %this1 = load %class.A** %this.addr
     31   ret void, !dbg !27
     32 }
     33 
     34 ; Function Attrs: nounwind readnone
     35 declare void @llvm.dbg.declare(metadata, metadata) #1
     36 
     37 ; Function Attrs: nounwind
     38 define void @_Z1fv() #0 {
     39 entry:
     40   call void @_ZL3barv(), !dbg !28
     41   ret void, !dbg !28
     42 }
     43 
     44 ; Function Attrs: nounwind
     45 define internal void @_ZL3barv() #0 {
     46 entry:
     47   ret void, !dbg !29
     48 }
     49 
     50 attributes #0 = { nounwind }
     51 attributes #1 = { nounwind readnone }
     52 
     53 !llvm.dbg.cu = !{!0}
     54 !llvm.module.flags = !{!21, !22}
     55 !llvm.ident = !{!23}
     56 
     57 !0 = metadata !{i32 786449, metadata !1, i32 4, metadata !"clang version 3.5.0 ", i1 false, metadata !"", i32 0, metadata !2, metadata !3, metadata !14, metadata !2, metadata !2, metadata !"", i32 1} ; [ DW_TAG_compile_unit ] [<unknown>] [DW_LANG_C_plus_plus]
     58 !1 = metadata !{metadata !"<unknown>", metadata !""}
     59 !2 = metadata !{}
     60 !3 = metadata !{metadata !4}
     61 !4 = metadata !{i32 786434, metadata !5, null, metadata !"A", i32 2, i64 32, i64 32, i32 0, i32 0, null, metadata !6, i32 0, null, null, metadata !"_ZTS1A"} ; [ DW_TAG_class_type ] [A] [line 2, size 32, align 32, offset 0] [def] [from ]
     62 !5 = metadata !{metadata !"type-unique-odr-b.cpp", metadata !""}
     63 !6 = metadata !{metadata !7, metadata !9}
     64 !7 = metadata !{i32 786445, metadata !5, metadata !"_ZTS1A", metadata !"data", i32 3, i64 32, i64 32, i64 0, i32 1, metadata !8} ; [ DW_TAG_member ] [data] [line 3, size 32, align 32, offset 0] [private] [from int]
     65 !8 = metadata !{i32 786468, null, null, metadata !"int", i32 0, i64 32, i64 32, i64 0, i32 0, i32 5} ; [ DW_TAG_base_type ] [int] [line 0, size 32, align 32, offset 0, enc DW_ATE_signed]
     66 !9 = metadata !{i32 786478, metadata !5, metadata !"_ZTS1A", metadata !"getFoo", metadata !"getFoo", metadata !"_ZN1A6getFooEv", i32 5, metadata !10, i1 false, i1 false, i32 0, i32 0, null, i32 258, i1 false, null, null, i32 0, metadata !13, i32 5} ; [ DW_TAG_subprogram ] [line 5] [protected] [getFoo]
     67 !10 = metadata !{i32 786453, i32 0, null, metadata !"", i32 0, i64 0, i64 0, i64 0, i32 0, null, metadata !11, i32 0, null, null, null} ; [ DW_TAG_subroutine_type ] [line 0, size 0, align 0, offset 0] [from ]
     68 !11 = metadata !{null, metadata !12}
     69 !12 = metadata !{i32 786447, null, null, metadata !"", i32 0, i64 64, i64 64, i64 0, i32 1088, metadata !"_ZTS1A"} ; [ DW_TAG_pointer_type ] [line 0, size 64, align 64, offset 0] [artificial] [from _ZTS1A]
     70 !13 = metadata !{i32 786468}
     71 !14 = metadata !{metadata !15, metadata !16, metadata !20}
     72 !15 = metadata !{i32 786478, metadata !5, metadata !"_ZTS1A", metadata !"getFoo", metadata !"getFoo", metadata !"_ZN1A6getFooEv", i32 8, metadata !10, i1 false, i1 true, i32 0, i32 0, null, i32 256, i1 false, void (%class.A*)* @_ZN1A6getFooEv, null, metadata !9, metadata !2, i32 8} ; [ DW_TAG_subprogram ] [line 8] [def] [getFoo]
     73 !16 = metadata !{i32 786478, metadata !5, metadata !17, metadata !"f", metadata !"f", metadata !"_Z1fv", i32 11, metadata !18, i1 false, i1 true, i32 0, i32 0, null, i32 256, i1 false, void ()* @_Z1fv, null, null, metadata !2, i32 11} ; [ DW_TAG_subprogram ] [line 11] [def] [f]
     74 !17 = metadata !{i32 786473, metadata !5}         ; [ DW_TAG_file_type ] [type-unique-odr-b.cpp]
     75 !18 = metadata !{i32 786453, i32 0, null, metadata !"", i32 0, i64 0, i64 0, i64 0, i32 0, null, metadata !19, i32 0, null, null, null} ; [ DW_TAG_subroutine_type ] [line 0, size 0, align 0, offset 0] [from ]
     76 !19 = metadata !{null}
     77 !20 = metadata !{i32 786478, metadata !5, metadata !17, metadata !"bar", metadata !"bar", metadata !"_ZL3barv", i32 10, metadata !18, i1 true, i1 true, i32 0, i32 0, null, i32 256, i1 false, void ()* @_ZL3barv, null, null, metadata !2, i32 10} ; [ DW_TAG_subprogram ] [line 10] [local] [def] [bar]
     78 !21 = metadata !{i32 2, metadata !"Dwarf Version", i32 4}
     79 !22 = metadata !{i32 1, metadata !"Debug Info Version", i32 1}
     80 !23 = metadata !{metadata !"clang version 3.5.0 "}
     81 !24 = metadata !{i32 786689, metadata !15, metadata !"this", null, i32 16777216, metadata !25, i32 1088, i32 0} ; [ DW_TAG_arg_variable ] [this] [line 0]
     82 !25 = metadata !{i32 786447, null, null, metadata !"", i32 0, i64 64, i64 64, i64 0, i32 0, metadata !"_ZTS1A"} ; [ DW_TAG_pointer_type ] [line 0, size 64, align 64, offset 0] [from _ZTS1A]
     83 !26 = metadata !{i32 0, i32 0, metadata !15, null}
     84 !27 = metadata !{i32 8, i32 0, metadata !15, null} ; [ DW_TAG_imported_declaration ]
     85 !28 = metadata !{i32 11, i32 0, metadata !16, null}
     86 !29 = metadata !{i32 10, i32 0, metadata !20, null}
     87