| 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 -O0 -filetype=obj < %t.ll | llvm-dwarfdump -v -debug-info - | FileCheck %s |
| 8 |
|
| 9 |
; IR generated with `clang -Xclang -debug-info-kind=limited -emit-llvm -S` from the following code: |
| 10 |
; class A { |
| 11 |
; public: |
| 12 |
; template <int T> static int foo() { return T; } |
| 13 |
; }; |
| 14 |
; |
| 15 |
; int main() { |
| 16 |
; A::template foo<42>(); |
| 17 |
; } |
| 18 |
|
| 19 |
; CHECK: DW_TAG_subprogram |
| 20 |
; CHECK: DW_AT_name{{.*}}"foo<42>" |
| 21 |
|
| 22 |
; CHECK: DW_TAG_template_value_parameter |
| 23 |
; CHECK: DW_AT_type {{.*}} "int" |
| 24 |
; CHECK: DW_AT_name {{.*}} "T" |
| 25 |
; CHECK: DW_AT_const_value {{.*}} (42) |
| 26 |
|
| 27 |
; ModuleID = 'templ-func-decl.cpp' |
| 28 |
source_filename = "templ-func-decl.cpp" |
| 29 |
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" |
| 30 |
target triple = "spir64-unknown-unknown" |
| 31 |
|
| 32 |
$_ZN1A3fooILi42EEEiv = comdat any |
| 33 |
|
| 34 |
; Function Attrs: noinline norecurse optnone uwtable |
| 35 |
define dso_local i32 @main() #0 !dbg !6 { |
| 36 |
entry: |
| 37 |
%call = call i32 @_ZN1A3fooILi42EEEiv(), !dbg !10 |
| 38 |
ret i32 0, !dbg !11 |
| 39 |
} |
| 40 |
|
| 41 |
; Function Attrs: noinline nounwind optnone uwtable |
| 42 |
define linkonce_odr dso_local i32 @_ZN1A3fooILi42EEEiv() #1 comdat align 2 !dbg !12 { |
| 43 |
entry: |
| 44 |
ret i32 42, !dbg !17 |
| 45 |
} |
| 46 |
|
| 47 |
attributes #0 = { noinline norecurse optnone uwtable "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "min-legal-vector-width"="0" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+fxsr,+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" } |
| 48 |
attributes #1 = { noinline nounwind optnone uwtable "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "min-legal-vector-width"="0" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+fxsr,+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" } |
| 49 |
|
| 50 |
!llvm.dbg.cu = !{!0} |
| 51 |
!llvm.module.flags = !{!3, !4} |
| 52 |
!llvm.ident = !{!5} |
| 53 |
|
| 54 |
!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !1, producer: "clang version 8.0.0 ", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, nameTableKind: None) |
| 55 |
!1 = !DIFile(filename: "templ-func-decl.cpp", directory: "/tmp") |
| 56 |
!2 = !{} |
| 57 |
!3 = !{i32 2, !"Debug Info Version", i32 3} |
| 58 |
!4 = !{i32 1, !"wchar_size", i32 4} |
| 59 |
!5 = !{!"clang version 8.0.0 "} |
| 60 |
!6 = distinct !DISubprogram(name: "main", scope: !1, file: !1, line: 6, type: !7, isLocal: false, isDefinition: true, scopeLine: 6, flags: DIFlagPrototyped, isOptimized: false, unit: !0, retainedNodes: !2) |
| 61 |
!7 = !DISubroutineType(types: !8) |
| 62 |
!8 = !{!9} |
| 63 |
!9 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed) |
| 64 |
!10 = !DILocation(line: 7, column: 3, scope: !6) |
| 65 |
!11 = !DILocation(line: 8, column: 1, scope: !6) |
| 66 |
!12 = distinct !DISubprogram(name: "foo<42>", linkageName: "_ZN1A3fooILi42EEEiv", scope: !13, file: !1, line: 3, type: !7, isLocal: false, isDefinition: true, scopeLine: 3, flags: DIFlagPrototyped, isOptimized: false, unit: !0, templateParams: !15, declaration: !14, retainedNodes: !2) |
| 67 |
!13 = distinct !DICompositeType(tag: DW_TAG_class_type, name: "A", file: !1, line: 1, size: 8, flags: DIFlagTypePassByValue, elements: !2, identifier: "_ZTS1A") |
| 68 |
!14 = !DISubprogram(name: "foo<42>", linkageName: "_ZN1A3fooILi42EEEiv", scope: !13, file: !1, line: 3, type: !7, isLocal: false, isDefinition: false, scopeLine: 3, flags: DIFlagPublic | DIFlagPrototyped | DIFlagStaticMember, isOptimized: false, templateParams: !15) |
| 69 |
!15 = !{!16} |
| 70 |
!16 = !DITemplateValueParameter(name: "T", type: !9, value: i32 42) |
| 71 |
!17 = !DILocation(line: 3, column: 39, scope: !12) |