1; Check that we handle template types for split-dwarf-inlining correctly. 2; RUN: llc -split-dwarf-file=%t.dwo -O2 < %s -dwarf-version=5 -mtriple=x86_64-unknown-linux-gnu -filetype=obj -o - | llvm-dwarfdump - | FileCheck %s 3; 4; The test case is generated from the following code 5; clang -cc1 -emit-llvm -fdebug-info-for-profiling -fsplit-dwarf-inlining -debug-info-kind=constructor -dwarf-version=5 -split-dwarf-file temp.dwo -O2 6; 7; void f1(); 8; 9; template <typename T> 10; void f2() { 11; f1(); 12; } 13; 14; void f3() { 15; f2<int>(); 16; } 17 18; CHECK: .debug_info contents: 19; CHECK: DW_TAG_skeleton_unit 20; CHECK: DW_TAG_subprogram 21; CHECK-NEXT: DW_AT_linkage_name ("_Z2f2IiEvv") 22; CHECK-NEXT: DW_AT_name ("f2<int>") 23; CHECK: DW_TAG_template_type_parameter 24; CHECK-NEXT: DW_AT_type (0x{{.*}} "int") 25; CHECK-NEXT: DW_AT_name ("T") 26; CHECK: .debug_info.dwo contents: 27; CHECK: DW_TAG_compile_unit 28; CHECK: DW_TAG_subprogram 29; CHECK-NEXT: DW_AT_linkage_name ("_Z2f2IiEvv") 30; CHECK-NEXT: DW_AT_name ("f2<int>") 31; CHECK: DW_TAG_template_type_parameter 32; CHECK-NEXT: DW_AT_type (0x{{.*}} "int") 33; CHECK-NEXT: DW_AT_name ("T") 34 35; ModuleID = 'split-debug-inlining-template.cpp' 36source_filename = "llvm-project/clang/test/CodeGen/split-debug-inlining-template.cpp" 37target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" 38target triple = "x86_64-redhat-linux-gnu" 39 40; Function Attrs: mustprogress nounwind 41define dso_local void @_Z2f3v() local_unnamed_addr #0 !dbg !6 { 42entry: 43 tail call void @_Z2f1v() #2, !dbg !11 44 ret void, !dbg !17 45} 46 47declare !dbg !18 void @_Z2f1v() local_unnamed_addr #1 48 49attributes #0 = { mustprogress nounwind "frame-pointer"="none" "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+cx8,+mmx,+sse,+sse2,+x87" } 50attributes #1 = { "frame-pointer"="none" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+cx8,+mmx,+sse,+sse2,+x87" } 51attributes #2 = { nounwind } 52 53!llvm.dbg.cu = !{!0} 54!llvm.module.flags = !{!2, !3, !4} 55!llvm.ident = !{!5} 56 57!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14, file: !1, producer: "clang version 15.0.0 (https://github.com/llvm/llvm-project.git 8b2b9c3fa91ebe583f8c634482885a669b82a1f0)", isOptimized: true, runtimeVersion: 0, splitDebugFilename: "split-debug-inlining-template.c.tmp.dwo", emissionKind: FullDebug, debugInfoForProfiling: true, nameTableKind: None) 58!1 = !DIFile(filename: "llvm-project/clang/test/CodeGen/<stdin>", directory: "build-debug", checksumkind: CSK_MD5, checksum: "0fb39b3bb5a60928b5d9c251b2d91b2c") 59!2 = !{i32 7, !"Dwarf Version", i32 5} 60!3 = !{i32 2, !"Debug Info Version", i32 3} 61!4 = !{i32 1, !"wchar_size", i32 4} 62!5 = !{!"clang version 15.0.0 (https://github.com/llvm/llvm-project.git 8b2b9c3fa91ebe583f8c634482885a669b82a1f0)"} 63!6 = distinct !DISubprogram(name: "f3", linkageName: "_Z2f3v", scope: !7, file: !7, line: 11, type: !8, scopeLine: 11, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !10) 64!7 = !DIFile(filename: "llvm-project/clang/test/CodeGen/split-debug-inlining-template.cpp", directory: "", checksumkind: CSK_MD5, checksum: "0fb39b3bb5a60928b5d9c251b2d91b2c") 65!8 = !DISubroutineType(types: !9) 66!9 = !{null} 67!10 = !{} 68!11 = !DILocation(line: 8, column: 3, scope: !12, inlinedAt: !16) 69!12 = distinct !DISubprogram(name: "f2<int>", linkageName: "_Z2f2IiEvv", scope: !7, file: !7, line: 7, type: !8, scopeLine: 7, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, templateParams: !13, retainedNodes: !10) 70!13 = !{!14} 71!14 = !DITemplateTypeParameter(name: "T", type: !15) 72!15 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed) 73!16 = distinct !DILocation(line: 12, column: 3, scope: !6) 74!17 = !DILocation(line: 13, column: 1, scope: !6) 75!18 = !DISubprogram(name: "f1", linkageName: "_Z2f1v", scope: !7, file: !7, line: 4, type: !8, flags: DIFlagPrototyped, spFlags: DISPFlagOptimized, retainedNodes: !10) 76