1*9880d681SAndroid Build Coastguard Worker; RUN: llc -mcpu=core2 -mtriple=i686-pc-win32 -o - -O0 -filetype=obj < %s \ 2*9880d681SAndroid Build Coastguard Worker; RUN: | llvm-readobj -codeview | FileCheck %s 3*9880d681SAndroid Build Coastguard Worker 4*9880d681SAndroid Build Coastguard Worker; C++ source to regenerate: 5*9880d681SAndroid Build Coastguard Worker; namespace foo { 6*9880d681SAndroid Build Coastguard Worker; int bar(int x) { return x * 2; } 7*9880d681SAndroid Build Coastguard Worker; } 8*9880d681SAndroid Build Coastguard Worker; template <typename T, int (*)(int)> 9*9880d681SAndroid Build Coastguard Worker; void fn_tmpl() {} 10*9880d681SAndroid Build Coastguard Worker; template void fn_tmpl<int, foo::bar>(); 11*9880d681SAndroid Build Coastguard Worker; void f() { 12*9880d681SAndroid Build Coastguard Worker; fn_tmpl<int, foo::bar>(); 13*9880d681SAndroid Build Coastguard Worker; } 14*9880d681SAndroid Build Coastguard Worker 15*9880d681SAndroid Build Coastguard Worker; CHECK: ProcStart { 16*9880d681SAndroid Build Coastguard Worker; CHECK: FunctionType: bar ({{.*}}) 17*9880d681SAndroid Build Coastguard Worker; CHECK: DisplayName: foo::bar{{$}} 18*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: LinkageName: ?bar@foo@@YAHH@Z 19*9880d681SAndroid Build Coastguard Worker 20*9880d681SAndroid Build Coastguard Worker; CHECK: ProcStart { 21*9880d681SAndroid Build Coastguard Worker; CHECK: FunctionType: fn_tmpl ({{.*}}) 22*9880d681SAndroid Build Coastguard Worker; CHECK: DisplayName: foo::fn_tmpl<int,&foo::bar> 23*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: LinkageName: ??$fn_tmpl@H$1?bar@foo@@YAHH@Z@foo@@YAXXZ 24*9880d681SAndroid Build Coastguard Worker 25*9880d681SAndroid Build Coastguard Worker; ModuleID = 't.cpp' 26*9880d681SAndroid Build Coastguard Workersource_filename = "t.cpp" 27*9880d681SAndroid Build Coastguard Workertarget datalayout = "e-m:x-p:32:32-i64:64-f80:32-n8:16:32-a:0:32-S32" 28*9880d681SAndroid Build Coastguard Workertarget triple = "i386-pc-windows-msvc19.0.23918" 29*9880d681SAndroid Build Coastguard Worker 30*9880d681SAndroid Build Coastguard Worker$"\01??$fn_tmpl@H$1?bar@foo@@YAHH@Z@foo@@YAXXZ" = comdat any 31*9880d681SAndroid Build Coastguard Worker 32*9880d681SAndroid Build Coastguard Worker; Function Attrs: nounwind 33*9880d681SAndroid Build Coastguard Workerdefine i32 @"\01?bar@foo@@YAHH@Z"(i32 %x) #0 !dbg !6 { 34*9880d681SAndroid Build Coastguard Workerentry: 35*9880d681SAndroid Build Coastguard Worker %x.addr = alloca i32, align 4 36*9880d681SAndroid Build Coastguard Worker store i32 %x, i32* %x.addr, align 4 37*9880d681SAndroid Build Coastguard Worker call void @llvm.dbg.declare(metadata i32* %x.addr, metadata !11, metadata !12), !dbg !13 38*9880d681SAndroid Build Coastguard Worker %0 = load i32, i32* %x.addr, align 4, !dbg !14 39*9880d681SAndroid Build Coastguard Worker %mul = mul nsw i32 %0, 2, !dbg !15 40*9880d681SAndroid Build Coastguard Worker ret i32 %mul, !dbg !16 41*9880d681SAndroid Build Coastguard Worker} 42*9880d681SAndroid Build Coastguard Worker 43*9880d681SAndroid Build Coastguard Worker; Function Attrs: nounwind readnone 44*9880d681SAndroid Build Coastguard Workerdeclare void @llvm.dbg.declare(metadata, metadata, metadata) #1 45*9880d681SAndroid Build Coastguard Worker 46*9880d681SAndroid Build Coastguard Worker; Function Attrs: nounwind 47*9880d681SAndroid Build Coastguard Workerdefine weak_odr void @"\01??$fn_tmpl@H$1?bar@foo@@YAHH@Z@foo@@YAXXZ"() #0 comdat !dbg !17 { 48*9880d681SAndroid Build Coastguard Workerentry: 49*9880d681SAndroid Build Coastguard Worker ret void, !dbg !24 50*9880d681SAndroid Build Coastguard Worker} 51*9880d681SAndroid Build Coastguard Worker 52*9880d681SAndroid Build Coastguard Workerattributes #0 = { nounwind "disable-tail-calls"="false" "less-precise-fpmad"="false" "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" "stack-protector-buffer-size"="8" "target-cpu"="pentium4" "target-features"="+fxsr,+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" } 53*9880d681SAndroid Build Coastguard Workerattributes #1 = { nounwind readnone } 54*9880d681SAndroid Build Coastguard Worker 55*9880d681SAndroid Build Coastguard Worker!llvm.dbg.cu = !{!0} 56*9880d681SAndroid Build Coastguard Worker!llvm.module.flags = !{!3, !4} 57*9880d681SAndroid Build Coastguard Worker!llvm.ident = !{!5} 58*9880d681SAndroid Build Coastguard Worker 59*9880d681SAndroid Build Coastguard Worker!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !1, producer: "clang version 3.9.0 ", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !2) 60*9880d681SAndroid Build Coastguard Worker!1 = !DIFile(filename: "t.cpp", directory: "D:\5Csrc\5Cllvm\5Cbuild") 61*9880d681SAndroid Build Coastguard Worker!2 = !{} 62*9880d681SAndroid Build Coastguard Worker!3 = !{i32 2, !"CodeView", i32 1} 63*9880d681SAndroid Build Coastguard Worker!4 = !{i32 2, !"Debug Info Version", i32 3} 64*9880d681SAndroid Build Coastguard Worker!5 = !{!"clang version 3.9.0 "} 65*9880d681SAndroid Build Coastguard Worker!6 = distinct !DISubprogram(name: "bar", linkageName: "\01?bar@foo@@YAHH@Z", scope: !7, file: !1, line: 2, type: !8, isLocal: false, isDefinition: true, scopeLine: 2, flags: DIFlagPrototyped, isOptimized: false, unit: !0, variables: !2) 66*9880d681SAndroid Build Coastguard Worker!7 = !DINamespace(name: "foo", scope: null, file: !1, line: 1) 67*9880d681SAndroid Build Coastguard Worker!8 = !DISubroutineType(types: !9) 68*9880d681SAndroid Build Coastguard Worker!9 = !{!10, !10} 69*9880d681SAndroid Build Coastguard Worker!10 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed) 70*9880d681SAndroid Build Coastguard Worker!11 = !DILocalVariable(name: "x", arg: 1, scope: !6, file: !1, line: 2, type: !10) 71*9880d681SAndroid Build Coastguard Worker!12 = !DIExpression() 72*9880d681SAndroid Build Coastguard Worker!13 = !DILocation(line: 2, column: 13, scope: !6) 73*9880d681SAndroid Build Coastguard Worker!14 = !DILocation(line: 2, column: 25, scope: !6) 74*9880d681SAndroid Build Coastguard Worker!15 = !DILocation(line: 2, column: 27, scope: !6) 75*9880d681SAndroid Build Coastguard Worker!16 = !DILocation(line: 2, column: 18, scope: !6) 76*9880d681SAndroid Build Coastguard Worker!17 = distinct !DISubprogram(name: "fn_tmpl<int,&foo::bar>", linkageName: "\01??$fn_tmpl@H$1?bar@foo@@YAHH@Z@foo@@YAXXZ", scope: !7, file: !1, line: 4, type: !18, isLocal: false, isDefinition: true, scopeLine: 4, flags: DIFlagPrototyped, isOptimized: false, unit: !0, templateParams: !20, variables: !2) 77*9880d681SAndroid Build Coastguard Worker!18 = !DISubroutineType(types: !19) 78*9880d681SAndroid Build Coastguard Worker!19 = !{null} 79*9880d681SAndroid Build Coastguard Worker!20 = !{!21, !22} 80*9880d681SAndroid Build Coastguard Worker!21 = !DITemplateTypeParameter(name: "T", type: !10) 81*9880d681SAndroid Build Coastguard Worker!22 = !DITemplateValueParameter(type: !23, value: i32 (i32)* @"\01?bar@foo@@YAHH@Z") 82*9880d681SAndroid Build Coastguard Worker!23 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !8, size: 32, align: 32) 83*9880d681SAndroid Build Coastguard Worker!24 = !DILocation(line: 4, column: 17, scope: !17) 84