1 ; RUN: llc < %s | FileCheck %s --check-prefix=ASM 2 ; RUN: llc < %s -filetype=obj | llvm-readobj - -codeview | FileCheck %s --check-prefix=OBJ 3 4 ; C++ source to regenerate: 5 ; $ cat t.cpp 6 ; int first; 7 ; template <typename T> struct A { static const int comdat = 3; }; 8 ; const int *middle = &A<void>::comdat; 9 ; int last; 10 ; $ clang t.cpp -S -emit-llvm -g -gcodeview -o t.ll 11 12 ; ASM: .section .debug$S,"dr" 13 ; ASM: .p2align 2 14 ; ASM: .long 4 # Debug section magic 15 16 ; ASM: .short {{.*-.*}} # Record length 17 ; ASM: .short 4364 # Record kind: S_LDATA32 18 ; ASM: .long 116 # Type 19 ; ASM: .secrel32 "?first@@3HA" # DataOffset 20 ; ASM: .secidx "?first@@3HA" # Segment 21 ; ASM: .asciz "first" # Name 22 23 ; ASM: .short {{.*-.*}} # Record length 24 ; ASM: .short 4371 # Record kind: S_GTHREAD32 25 ; ASM: .long 4097 # Type 26 ; ASM: .secrel32 "?middle@@3PEBHEB" # DataOffset 27 ; ASM: .secidx "?middle@@3PEBHEB" # Segment 28 ; ASM: .asciz "middle" # Name 29 30 ; ASM: .short {{.*-.*}} # Record length 31 ; ASM: .short 4365 # Record kind: S_GDATA32 32 ; ASM: .long 116 # Type 33 ; ASM: .secrel32 "?last@@3HA" # DataOffset 34 ; ASM: .secidx "?last@@3HA" # Segment 35 ; ASM: .asciz "last" # Name 36 37 ; ASM: .section .debug$S,"dr",associative,"?comdat@?$A@X@@2HB" 38 ; ASM: .p2align 2 39 ; ASM: .long 4 # Debug section magic 40 41 ; ASM: .short {{.*-.*}} # Record length 42 ; ASM: .short 4365 # Record kind: S_GDATA32 43 ; ASM: .long 4096 # Type 44 ; ASM: .secrel32 "?comdat@?$A@X@@2HB" # DataOffset 45 ; ASM: .secidx "?comdat@?$A@X@@2HB" # Segment 46 ; ASM: .asciz "comdat" # Name 47 48 ; OBJ: CodeViewTypes [ 49 ; OBJ: Section: .debug$T 50 ; OBJ: Magic: 0x4 51 ; OBJ: Modifier (0x1000) { 52 ; OBJ: TypeLeafKind: LF_MODIFIER (0x1001) 53 ; OBJ: ModifiedType: int (0x74) 54 ; OBJ: Modifiers [ (0x1) 55 ; OBJ: Const (0x1) 56 ; OBJ: ] 57 ; OBJ: } 58 ; OBJ: Pointer (0x1001) { 59 ; OBJ: TypeLeafKind: LF_POINTER (0x1002) 60 ; OBJ: PointeeType: const int (0x1000) 61 ; OBJ: PointerAttributes: 0x1000C 62 ; OBJ: PtrType: Near64 (0xC) 63 ; OBJ: PtrMode: Pointer (0x0) 64 ; OBJ: IsFlat: 0 65 ; OBJ: IsConst: 0 66 ; OBJ: IsVolatile: 0 67 ; OBJ: IsUnaligned: 0 68 ; OBJ: } 69 ; OBJ: ] 70 71 ; OBJ: CodeViewDebugInfo [ 72 ; OBJ: Section: .debug$S 73 ; OBJ: Magic: 0x4 74 ; OBJ: Subsection [ 75 ; OBJ: SubSectionType: Symbols (0xF1) 76 ; OBJ: DataSym { 77 ; OBJ: Kind: S_LDATA32 (0x110C) 78 ; OBJ: DataOffset: ?first@@3HA+0x0 79 ; OBJ: Type: int (0x74) 80 ; OBJ: DisplayName: first 81 ; OBJ: LinkageName: ?first@@3HA 82 ; OBJ: } 83 ; OBJ: ThreadLocalDataSym { 84 ; OBJ: DataOffset: ?middle@@3PEBHEB+0x0 85 ; OBJ: Type: const int* (0x1001) 86 ; OBJ: DisplayName: middle 87 ; OBJ: LinkageName: ?middle@@3PEBHEB 88 ; OBJ: } 89 ; OBJ: DataSym { 90 ; OBJ: Kind: S_GDATA32 (0x110D) 91 ; OBJ: DataOffset: ?last@@3HA+0x0 92 ; OBJ: Type: int (0x74) 93 ; OBJ: DisplayName: last 94 ; OBJ: LinkageName: ?last@@3HA 95 ; OBJ: } 96 ; OBJ: ] 97 ; OBJ: ] 98 ; OBJ: CodeViewDebugInfo [ 99 ; OBJ: Section: .debug$S (7) 100 ; OBJ: Magic: 0x4 101 ; OBJ: Subsection [ 102 ; OBJ: SubSectionType: Symbols (0xF1) 103 ; OBJ: SubSectionSize: 0x15 104 ; OBJ: DataSym { 105 ; OBJ: DataOffset: ?comdat@?$A@X@@2HB+0x0 106 ; OBJ: Type: const int (0x1000) 107 ; OBJ: DisplayName: comdat 108 ; OBJ: LinkageName: ?comdat@?$A@X@@2HB 109 ; OBJ: } 110 ; OBJ: ] 111 ; OBJ: ] 112 113 ; ModuleID = 't.cpp' 114 source_filename = "t.cpp" 115 target datalayout = "e-m:w-i64:64-f80:128-n8:16:32:64-S128" 116 target triple = "x86_64-pc-windows-msvc19.0.23918" 117 118 $"\01?comdat@?$A@X@@2HB" = comdat any 119 120 @"\01?first@@3HA" = internal global i32 0, align 4 121 @"\01?comdat@?$A@X@@2HB" = linkonce_odr constant i32 3, comdat, align 4 122 @"\01?middle@@3PEBHEB" = thread_local global i32* @"\01?comdat@?$A@X@@2HB", align 8 123 @"\01?last@@3HA" = global i32 0, align 4 124 125 !llvm.dbg.cu = !{!0} 126 !llvm.module.flags = !{!16, !17, !18} 127 !llvm.ident = !{!19} 128 129 !0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !1, producer: "clang version 3.9.0 (trunk 271937)", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, globals: !3) 130 !1 = !DIFile(filename: "t.cpp", directory: "D:\5Csrc\5Cllvm\5Cbuild") 131 !2 = !{} 132 !3 = !{!4, !6, !13, !15} 133 !4 = distinct !DIGlobalVariable(name: "first", linkageName: "\01?first@@3HA", scope: !0, file: !1, line: 1, type: !5, isLocal: true, isDefinition: true, variable: i32* @"\01?first@@3HA") 134 !5 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed) 135 !6 = distinct !DIGlobalVariable(name: "comdat", linkageName: "\01?comdat@?$A@X@@2HB", scope: !0, file: !1, line: 2, type: !7, isLocal: false, isDefinition: true, variable: i32* @"\01?comdat@?$A@X@@2HB", declaration: !8) 136 !7 = !DIDerivedType(tag: DW_TAG_const_type, baseType: !5) 137 !8 = !DIDerivedType(tag: DW_TAG_member, name: "comdat", scope: !9, file: !1, line: 2, baseType: !7, flags: DIFlagStaticMember, extraData: i32 3) 138 !9 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "A<void>", file: !1, line: 2, size: 8, align: 8, elements: !10, templateParams: !11) 139 !10 = !{!8} 140 !11 = !{!12} 141 !12 = !DITemplateTypeParameter(name: "T", type: null) 142 !13 = distinct !DIGlobalVariable(name: "middle", linkageName: "\01?middle@@3PEBHEB", scope: !0, file: !1, line: 3, type: !14, isLocal: false, isDefinition: true, variable: i32** @"\01?middle@@3PEBHEB") 143 !14 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !7, size: 64, align: 64) 144 !15 = distinct !DIGlobalVariable(name: "last", linkageName: "\01?last@@3HA", scope: !0, file: !1, line: 4, type: !5, isLocal: false, isDefinition: true, variable: i32* @"\01?last@@3HA") 145 !16 = !{i32 2, !"CodeView", i32 1} 146 !17 = !{i32 2, !"Debug Info Version", i32 3} 147 !18 = !{i32 1, !"PIC Level", i32 2} 148 !19 = !{!"clang version 3.9.0 (trunk 271937)"} 149