1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352
|
; RUN: %llc_dwarf -O0 -filetype=obj -dwarf-linkage-names=All < %s | llvm-dwarfdump - | FileCheck %s --implicit-check-not "{{DW_TAG|NULL}}"
; CHECK: debug_info contents
; CHECK:DW_TAG_compile_unit
; CHECK: [[NS1:0x[0-9a-f]*]]:{{ *}}DW_TAG_namespace
; CHECK: DW_AT_name ("A")
; CHECK-NOT: DW_AT_decl_file
; CHECK-NOT: DW_AT_decl_line
; CHECK: [[NS2:0x[0-9a-f]*]]:{{ *}}DW_TAG_namespace
; CHECK: DW_AT_name ("B")
; CHECK-NOT: DW_AT_decl_file
; CHECK-NOT: DW_AT_decl_line
; CHECK: [[I:0x[0-9a-f]*]]:{{ *}}DW_TAG_variable
; CHECK: DW_AT_name ("i")
; CHECK: [[VAR_FWD:0x[0-9a-f]*]]:{{ *}}DW_TAG_variable
; CHECK: DW_AT_name ("var_fwd")
; CHECK: [[FOO:0x[0-9a-f]*]]:{{ *}}DW_TAG_structure_type
; CHECK: DW_AT_name ("foo")
; CHECK: DW_AT_declaration
; CHECK: [[BAR:0x[0-9a-f]*]]:{{ *}}DW_TAG_structure_type
; CHECK: DW_AT_name ("bar")
; CHECK: DW_TAG_subprogram
; CHECK: DW_AT_MIPS_linkage_name
; CHECK: DW_AT_name ("f1")
; CHECK: [[FUNC1:.*]]: DW_TAG_subprogram
; CHECK: DW_AT_MIPS_linkage_name
; CHECK: DW_AT_name ("f1")
; CHECK: DW_TAG_formal_parameter
; CHECK: NULL
; CHECK: [[BAZ:0x[0-9a-f]*]]:{{.*}}DW_TAG_typedef
; CHECK: DW_AT_name ("baz")
; CHECK: [[VAR_DECL:0x[0-9a-f]*]]:{{.*}}DW_TAG_variable
; CHECK: DW_AT_name ("var_decl")
; CHECK: DW_AT_declaration
; CHECK: [[FUNC_DECL:0x[0-9a-f]*]]:{{.*}}DW_TAG_subprogram
; CHECK: DW_AT_name ("func_decl")
; CHECK: DW_AT_declaration
; CHECK: [[FUNC_FWD:0x[0-9a-f]*]]:{{.*}}DW_TAG_subprogram
; CHECK: DW_AT_name ("func_fwd")
; CHECK-NOT: DW_AT_declaration
; CHECK: NULL
; CHECK: DW_TAG_imported_module
; CHECK: DW_AT_decl_file ([[F2:.*]])
; CHECK: DW_AT_decl_line (15)
; CHECK: DW_AT_import ([[NS2]])
; CHECK: DW_TAG_imported_declaration
; CHECK: NULL
; CHECK: DW_TAG_base_type
; CHECK: DW_TAG_imported_module
; CHECK: DW_AT_decl_file ([[F2:.*]])
; CHECK: DW_AT_decl_line (18)
; CHECK: DW_AT_import ([[NS1]])
; CHECK: DW_TAG_imported_declaration
; CHECK: DW_TAG_subprogram
; CHECK: DW_TAG_subprogram
; CHECK: DW_AT_MIPS_linkage_name
; CHECK: DW_AT_name ("func")
; CHECK: DW_TAG_formal_parameter
; CHECK: DW_TAG_imported_module
; CHECK: DW_AT_decl_file ([[F2:.*]])
; CHECK: DW_AT_decl_line (26)
; CHECK: DW_AT_import ([[NS1]])
; CHECK: DW_TAG_imported_declaration
; CHECK: DW_AT_decl_file ([[F2]])
; CHECK: DW_AT_decl_line (27)
; CHECK: DW_AT_import ([[FOO]])
; CHECK: DW_TAG_imported_declaration
; CHECK: DW_AT_decl_file ([[F2]])
; CHECK: DW_AT_decl_line (28)
; CHECK: DW_AT_import ([[BAR]])
; CHECK: DW_TAG_imported_declaration
; CHECK: DW_AT_decl_file ([[F2]])
; CHECK: DW_AT_decl_line (29)
; CHECK: DW_AT_import ([[FUNC1]])
; CHECK: DW_TAG_imported_declaration
; CHECK: DW_AT_decl_file ([[F2]])
; CHECK: DW_AT_decl_line (30)
; CHECK: DW_AT_import ([[I]])
; CHECK: DW_TAG_imported_declaration
; CHECK: DW_AT_decl_file ([[F2]])
; CHECK: DW_AT_decl_line (31)
; CHECK: DW_AT_import ([[BAZ]])
; CHECK: [[X:0x[0-9a-f]*]]:{{ *}}DW_TAG_imported_declaration
; CHECK: DW_AT_decl_file ([[F2]])
; CHECK: DW_AT_decl_line (32)
; CHECK: DW_AT_import ([[NS1]])
; CHECK: DW_AT_name ("X")
; CHECK: DW_TAG_imported_declaration
; CHECK: DW_AT_decl_file ([[F2]])
; CHECK: DW_AT_decl_line (33)
; CHECK: DW_AT_import ([[X]])
; CHECK: DW_AT_name ("Y")
; CHECK: DW_TAG_imported_declaration
; CHECK: DW_AT_decl_file ([[F2]])
; CHECK: DW_AT_decl_line (34)
; CHECK: DW_AT_import ([[VAR_DECL]])
; CHECK: DW_TAG_imported_declaration
; CHECK: DW_AT_decl_file ([[F2]])
; CHECK: DW_AT_decl_line (35)
; CHECK: DW_AT_import ([[FUNC_DECL]])
; CHECK: DW_TAG_imported_declaration
; CHECK: DW_AT_decl_file ([[F2]])
; CHECK: DW_AT_decl_line (36)
; CHECK: DW_AT_import ([[VAR_FWD]])
; CHECK: DW_TAG_imported_declaration
; CHECK: DW_AT_decl_file ([[F2]])
; CHECK: DW_AT_decl_line (37)
; CHECK: DW_AT_import ([[FUNC_FWD]])
; CHECK: DW_TAG_lexical_block
; CHECK: DW_TAG_imported_module
; CHECK: DW_AT_decl_file ([[F2]])
; CHECK: DW_AT_decl_line (23)
; CHECK: DW_AT_import {{.*}}
; CHECK: NULL
; CHECK: NULL
; CHECK: DW_TAG_subprogram
; CHECK: DW_TAG_base_type
; CHECK: NULL
; IR generated from clang/test/CodeGenCXX/debug-info-namespace.cpp, file paths
; changed to protect the guilty. The C++ source code is:
; // RUN...
; // RUN...
; // RUN...
;
; namespace A {
; #line 1 "foo.cpp"
; namespace B {
; extern int i;
; int f1() { return 0; }
; void f1(int) { }
; struct foo;
; struct bar { };
; typedef bar baz;
; extern int var_decl;
; void func_decl(void);
; extern int var_fwd;
; void func_fwd(void);
; }
; }
; namespace A {
; using namespace B;
; }
;
; using namespace A;
; namespace E = A;
; int B::i = f1();
; int func(bool b) {
; if (b) {
; using namespace A::B;
; return i;
; }
; using namespace A;
; using B::foo;
; using B::bar;
; using B::f1;
; using B::i;
; using B::baz;
; namespace X = A;
; namespace Y = X;
; using B::var_decl;
; using B::func_decl;
; using B::var_fwd;
; using B::func_fwd;
; return i + X::B::i + Y::B::i;
; }
;
; namespace A {
; using B::i;
; namespace B {
; int var_fwd = i;
; }
; }
; void B::func_fwd() {}
@_ZN1A1B1iE = global i32 0, align 4, !dbg !131
@_ZN1A1B7var_fwdE = global i32 0, align 4, !dbg !132
@llvm.global_ctors = appending global [1 x { i32, ptr, ptr }] [{ i32, ptr, ptr } { i32 65535, ptr @_GLOBAL__sub_I_debug_info_namespace.cpp, ptr null }]
; Function Attrs: nounwind ssp uwtable
define i32 @_ZN1A1B2f1Ev() #0 !dbg !10 {
entry:
ret i32 0, !dbg !60
}
; Function Attrs: nounwind ssp uwtable
define void @_ZN1A1B2f1Ei(i32) #0 !dbg !14 {
entry:
%.addr = alloca i32, align 4
store i32 %0, ptr %.addr, align 4
call void @llvm.dbg.declare(metadata ptr %.addr, metadata !61, metadata !62), !dbg !63
ret void, !dbg !64
}
; Function Attrs: nounwind readnone
declare void @llvm.dbg.declare(metadata, metadata, metadata) #1
define internal void @__cxx_global_var_init() section "__TEXT,__StaticInit,regular,pure_instructions" !dbg !17 {
entry:
%call = call i32 @_ZN1A1B2f1Ev(), !dbg !65
store i32 %call, ptr @_ZN1A1B1iE, align 4, !dbg !65
ret void, !dbg !65
}
; Function Attrs: nounwind ssp uwtable
define i32 @_Z4funcb(i1 zeroext %b) #0 !dbg !21 {
entry:
%retval = alloca i32, align 4
%b.addr = alloca i8, align 1
%frombool = zext i1 %b to i8
store i8 %frombool, ptr %b.addr, align 1
call void @llvm.dbg.declare(metadata ptr %b.addr, metadata !66, metadata !62), !dbg !67
%0 = load i8, ptr %b.addr, align 1, !dbg !68
%tobool = trunc i8 %0 to i1, !dbg !68
br i1 %tobool, label %if.then, label %if.end, !dbg !68
if.then: ; preds = %entry
%1 = load i32, ptr @_ZN1A1B1iE, align 4, !dbg !69
store i32 %1, ptr %retval, !dbg !69
br label %return, !dbg !69
if.end: ; preds = %entry
%2 = load i32, ptr @_ZN1A1B1iE, align 4, !dbg !70
%3 = load i32, ptr @_ZN1A1B1iE, align 4, !dbg !70
%add = add nsw i32 %2, %3, !dbg !70
%4 = load i32, ptr @_ZN1A1B1iE, align 4, !dbg !70
%add1 = add nsw i32 %add, %4, !dbg !70
store i32 %add1, ptr %retval, !dbg !70
br label %return, !dbg !70
return: ; preds = %if.end, %if.then
%5 = load i32, ptr %retval, !dbg !71
ret i32 %5, !dbg !71
}
define internal void @__cxx_global_var_init1() section "__TEXT,__StaticInit,regular,pure_instructions" !dbg !25 {
entry:
%0 = load i32, ptr @_ZN1A1B1iE, align 4, !dbg !72
store i32 %0, ptr @_ZN1A1B7var_fwdE, align 4, !dbg !72
ret void, !dbg !72
}
; Function Attrs: nounwind ssp uwtable
define void @_ZN1A1B8func_fwdEv() #0 !dbg !26 {
entry:
ret void, !dbg !73
}
define internal void @_GLOBAL__sub_I_debug_info_namespace.cpp() section "__TEXT,__StaticInit,regular,pure_instructions" {
entry:
call void @__cxx_global_var_init(), !dbg !74
call void @__cxx_global_var_init1(), !dbg !74
ret void, !dbg !74
}
attributes #0 = { nounwind ssp uwtable "less-precise-fpmad"="false" "frame-pointer"="all" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
attributes #1 = { nounwind readnone }
!llvm.dbg.cu = !{!0}
!llvm.module.flags = !{!57, !58}
!llvm.ident = !{!59}
!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, producer: "clang version 3.6.0 ", isOptimized: false, emissionKind: FullDebug, file: !1, enums: !2, retainedTypes: !3, globals: !30, imports: !33)
!1 = !DIFile(filename: "debug-info-namespace.cpp", directory: "/tmp")
!2 = !{}
!3 = !{!4, !8}
!4 = !DICompositeType(tag: DW_TAG_structure_type, name: "foo", line: 5, flags: DIFlagFwdDecl, file: !5, scope: !6, identifier: "_ZTSN1A1B3fooE")
!5 = !DIFile(filename: "foo.cpp", directory: "/tmp")
!6 = !DINamespace(name: "B", scope: !7)
!7 = !DINamespace(name: "A", scope: null)
!8 = !DICompositeType(tag: DW_TAG_structure_type, name: "bar", line: 6, size: 8, align: 8, file: !5, scope: !6, elements: !2, identifier: "_ZTSN1A1B3barE")
!10 = distinct !DISubprogram(name: "f1", linkageName: "_ZN1A1B2f1Ev", line: 3, isLocal: false, isDefinition: true, flags: DIFlagPrototyped, isOptimized: false, unit: !0, scopeLine: 3, file: !5, scope: !6, type: !11, retainedNodes: !2)
!11 = !DISubroutineType(types: !12)
!12 = !{!13}
!13 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
!14 = distinct !DISubprogram(name: "f1", linkageName: "_ZN1A1B2f1Ei", line: 4, isLocal: false, isDefinition: true, flags: DIFlagPrototyped, isOptimized: false, unit: !0, scopeLine: 4, file: !5, scope: !6, type: !15, retainedNodes: !2)
!15 = !DISubroutineType(types: !16)
!16 = !{null, !13}
!17 = distinct !DISubprogram(name: "__cxx_global_var_init", line: 20, isLocal: true, isDefinition: true, flags: DIFlagPrototyped, isOptimized: false, unit: !0, scopeLine: 20, file: !5, scope: !18, type: !19, retainedNodes: !2)
!18 = !DIFile(filename: "foo.cpp", directory: "/tmp")
!19 = !DISubroutineType(types: !20)
!20 = !{null}
!21 = distinct !DISubprogram(name: "func", linkageName: "_Z4funcb", line: 21, isLocal: false, isDefinition: true, flags: DIFlagPrototyped, isOptimized: false, unit: !0, scopeLine: 21, file: !5, scope: !18, type: !22, retainedNodes: !2)
!22 = !DISubroutineType(types: !23)
!23 = !{!13, !24}
!24 = !DIBasicType(tag: DW_TAG_base_type, name: "bool", size: 8, align: 8, encoding: DW_ATE_boolean)
!25 = distinct !DISubprogram(name: "__cxx_global_var_init1", line: 44, isLocal: true, isDefinition: true, flags: DIFlagPrototyped, isOptimized: false, unit: !0, scopeLine: 44, file: !5, scope: !18, type: !19, retainedNodes: !2)
!26 = distinct !DISubprogram(name: "func_fwd", linkageName: "_ZN1A1B8func_fwdEv", line: 47, isLocal: false, isDefinition: true, flags: DIFlagPrototyped, isOptimized: false, unit: !0, scopeLine: 47, file: !5, scope: !6, type: !19, retainedNodes: !2)
!27 = distinct !DISubprogram(name: "", linkageName: "_GLOBAL__sub_I_debug_info_namespace.cpp", isLocal: true, isDefinition: true, flags: DIFlagArtificial, isOptimized: false, unit: !0, file: !1, scope: !28, type: !29, retainedNodes: !2)
!28 = !DIFile(filename: "debug-info-namespace.cpp", directory: "/tmp")
!29 = !DISubroutineType(types: !2)
!30 = !{!131, !132}
!31 = !DIGlobalVariable(name: "i", linkageName: "_ZN1A1B1iE", line: 20, isLocal: false, isDefinition: true, scope: !6, file: !18, type: !13)
!32 = !DIGlobalVariable(name: "var_fwd", linkageName: "_ZN1A1B7var_fwdE", line: 44, isLocal: false, isDefinition: true, scope: !6, file: !18, type: !13)
!33 = !{!34, !35, !36, !37, !40, !41, !42, !43, !44, !45, !47, !48, !49, !51, !54, !55, !56}
!34 = !DIImportedEntity(tag: DW_TAG_imported_module, file: !5, line: 15, scope: !7, entity: !6)
!35 = !DIImportedEntity(tag: DW_TAG_imported_module, file: !5, line: 18, scope: !0, entity: !7)
!36 = !DIImportedEntity(tag: DW_TAG_imported_declaration, file: !5, line: 19, name: "E", scope: !0, entity: !7)
!37 = !DIImportedEntity(tag: DW_TAG_imported_module, file: !5, line: 23, scope: !38, entity: !6)
!38 = distinct !DILexicalBlock(line: 22, column: 10, file: !5, scope: !39)
!39 = distinct !DILexicalBlock(line: 22, column: 7, file: !5, scope: !21)
!40 = !DIImportedEntity(tag: DW_TAG_imported_module, file: !5, line: 26, scope: !21, entity: !7)
!41 = !DIImportedEntity(tag: DW_TAG_imported_declaration, file: !5, line: 27, scope: !21, entity: !4)
!42 = !DIImportedEntity(tag: DW_TAG_imported_declaration, file: !5, line: 28, scope: !21, entity: !8)
!43 = !DIImportedEntity(tag: DW_TAG_imported_declaration, file: !5, line: 29, scope: !21, entity: !14)
!44 = !DIImportedEntity(tag: DW_TAG_imported_declaration, file: !5, line: 30, scope: !21, entity: !31)
!45 = !DIImportedEntity(tag: DW_TAG_imported_declaration, file: !5, line: 31, scope: !21, entity: !46)
!46 = !DIDerivedType(tag: DW_TAG_typedef, name: "baz", line: 7, file: !5, scope: !6, baseType: !8)
!47 = !DIImportedEntity(tag: DW_TAG_imported_declaration, file: !5, line: 32, name: "X", scope: !21, entity: !7)
!48 = !DIImportedEntity(tag: DW_TAG_imported_declaration, file: !5, line: 33, name: "Y", scope: !21, entity: !47)
!49 = !DIImportedEntity(tag: DW_TAG_imported_declaration, file: !5, line: 34, scope: !21, entity: !50)
!50 = !DIGlobalVariable(name: "var_decl", linkageName: "_ZN1A1B8var_declE", line: 8, isLocal: false, isDefinition: false, scope: !6, file: !18, type: !13)
!51 = !DIImportedEntity(tag: DW_TAG_imported_declaration, file: !5, line: 35, scope: !21, entity: !52)
!52 = !DISubprogram(name: "func_decl", linkageName: "_ZN1A1B9func_declEv", line: 9, isLocal: false, isDefinition: false, flags: DIFlagPrototyped, isOptimized: false, file: !5, scope: !6, type: !19, retainedNodes: !53)
!53 = !{} ; previously: invalid DW_TAG_base_type
!54 = !DIImportedEntity(tag: DW_TAG_imported_declaration, file: !5, line: 36, scope: !21, entity: !32)
!55 = !DIImportedEntity(tag: DW_TAG_imported_declaration, file: !5, line: 37, scope: !21, entity: !26)
!56 = !DIImportedEntity(tag: DW_TAG_imported_declaration, file: !5, line: 42, scope: !7, entity: !31)
!57 = !{i32 2, !"Dwarf Version", i32 3}
!58 = !{i32 2, !"Debug Info Version", i32 3}
!59 = !{!"clang version 3.6.0 "}
!60 = !DILocation(line: 3, column: 12, scope: !10)
!61 = !DILocalVariable(name: "", line: 4, arg: 1, scope: !14, file: !18, type: !13)
!62 = !DIExpression()
!63 = !DILocation(line: 4, column: 12, scope: !14)
!64 = !DILocation(line: 4, column: 16, scope: !14)
!65 = !DILocation(line: 20, column: 12, scope: !17)
!66 = !DILocalVariable(name: "b", line: 21, arg: 1, scope: !21, file: !18, type: !24)
!67 = !DILocation(line: 21, column: 15, scope: !21)
!68 = !DILocation(line: 22, column: 7, scope: !21)
!69 = !DILocation(line: 24, column: 5, scope: !38)
!70 = !DILocation(line: 38, column: 3, scope: !21)
!71 = !DILocation(line: 39, column: 1, scope: !21)
!72 = !DILocation(line: 44, column: 15, scope: !25)
!73 = !DILocation(line: 47, column: 21, scope: !26)
!74 = !DILocation(line: 0, scope: !75)
!75 = !DILexicalBlockFile(discriminator: 0, file: !5, scope: !27)
!131 = !DIGlobalVariableExpression(var: !31, expr: !DIExpression())
!132 = !DIGlobalVariableExpression(var: !32, expr: !DIExpression())
|