| 1 |
; REQUIRES: object-emission |
| 2 |
|
| 3 |
; RUN: llvm-as < %s -o %t.bc |
| 4 |
; RUN: llvm-spirv %t.bc -o %t.spv |
| 5 |
; RUN: llvm-spirv -r -emit-opaque-pointers %t.spv -o - | llvm-dis -o %t.ll |
| 6 |
|
| 7 |
; RUN: llc -mtriple=x86_64-linux-gnu -filetype=obj %t.ll -o - | llvm-dwarfdump -all - | FileCheck %s |
| 8 |
|
| 9 |
; Test that we accept and generate DWARF entities for DW_TAG_structure_type, |
| 10 |
; DW_TAG_member and DW_TAG_typedef with no source location. These can come up |
| 11 |
; in some languages with predefined types. |
| 12 |
|
| 13 |
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" |
| 14 |
target triple = "spir64-unknown-unknown" |
| 15 |
|
| 16 |
%struct.S = type { %struct.S* } |
| 17 |
|
| 18 |
define void @f() !dbg !4 { |
| 19 |
%x = alloca %struct.S, align 8 |
| 20 |
; CHECK: DW_TAG_typedef |
| 21 |
; CHECK-NOT: DW_AT_decl_file |
| 22 |
; CHECK-NOT: DW_AT_decl_line |
| 23 |
|
| 24 |
; CHECK: DW_TAG_structure_type |
| 25 |
; CHECK-NOT: DW_AT_decl_file |
| 26 |
; CHECK-NOT: DW_AT_decl_line |
| 27 |
|
| 28 |
; CHECK: DW_TAG_member |
| 29 |
; CHECK-NOT: DW_AT_decl_file |
| 30 |
; CHECK-NOT: DW_AT_decl_line |
| 31 |
|
| 32 |
; CHECK: {{DW_TAG|NULL}} |
| 33 |
call void @llvm.dbg.declare(metadata %struct.S* %x, metadata !10, metadata !16), !dbg !17 |
| 34 |
ret void, !dbg !18 |
| 35 |
} |
| 36 |
|
| 37 |
declare void @llvm.dbg.declare(metadata, metadata, metadata) #1 |
| 38 |
|
| 39 |
!llvm.dbg.cu = !{!0} |
| 40 |
!llvm.module.flags = !{!7, !8} |
| 41 |
!llvm.ident = !{!9} |
| 42 |
|
| 43 |
!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, retainedTypes: !2, globals: !2, imports: !2) |
| 44 |
!1 = !DIFile(filename: "file.c", directory: "/dir") |
| 45 |
!2 = !{} |
| 46 |
!4 = distinct !DISubprogram(name: "f", scope: !1, file: !1, line: 7, type: !5, isLocal: false, isDefinition: true, scopeLine: 7, isOptimized: false, unit: !0, retainedNodes: !2) |
| 47 |
!5 = !DISubroutineType(types: !6) |
| 48 |
!6 = !{null} |
| 49 |
!7 = !{i32 2, !"Dwarf Version", i32 4} |
| 50 |
!8 = !{i32 2, !"Debug Info Version", i32 3} |
| 51 |
!9 = !{!"clang"} |
| 52 |
!10 = !DILocalVariable(name: "x", scope: !4, file: !1, line: 8, type: !11) |
| 53 |
!11 = !DIDerivedType(tag: DW_TAG_typedef, name: "SS", baseType: !12) |
| 54 |
!12 = !DICompositeType(tag: DW_TAG_structure_type, name: "S", size: 64, align: 64, elements: !13) |
| 55 |
!13 = !{!14} |
| 56 |
!14 = !DIDerivedType(tag: DW_TAG_member, name: "s", scope: !12, baseType: !15, size: 64, align: 64) |
| 57 |
!15 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !12, size: 64, align: 64) |
| 58 |
!16 = !DIExpression() |
| 59 |
!17 = !DILocation(line: 8, column: 6, scope: !4) |
| 60 |
!18 = !DILocation(line: 9, column: 1, scope: !4) |