1; RUN: llc -mcpu=core2 -mtriple=i686-pc-win32 -o - -O0 -filetype=obj < %s \ 2; RUN: | llvm-readobj --codeview - | FileCheck %s 3 4; C++ source to regenerate: 5; namespace foo { 6; int bar(int x) { return x * 2; } 7; } 8; template <typename T, int (*)(int)> 9; void fn_tmpl() {} 10; template void fn_tmpl<int, foo::bar>(); 11; struct S { void operator<<(int i) {} }; 12; void f() { 13; fn_tmpl<int, foo::bar>(); 14; S s; 15; s << 3; 16; } 17 18; CHECK: {{.*}}Proc{{.*}}Sym { 19; CHECK: FunctionType: bar ({{.*}}) 20; CHECK: DisplayName: foo::bar{{$}} 21; CHECK-NEXT: LinkageName: ?bar@foo@@YAHH@Z 22 23; CHECK: {{.*}}Proc{{.*}}Sym { 24; CHECK: FunctionType: operator<< ({{.*}}) 25; CHECK: DisplayName: S::operator<< 26; CHECK-NEXT: LinkageName: ??6S@@QAEXH@Z 27 28; CHECK: {{.*}}Proc{{.*}}Sym { 29; CHECK: FunctionType: fn_tmpl ({{.*}}) 30; CHECK: DisplayName: foo::fn_tmpl<int,&foo::bar> 31; CHECK-NEXT: LinkageName: ??$fn_tmpl@H$1?bar@foo@@YAHH@Z@foo@@YAXXZ 32 33; ModuleID = 't.cpp' 34source_filename = "t.cpp" 35target datalayout = "e-m:x-p:32:32-i64:64-f80:32-n8:16:32-a:0:32-S32" 36target triple = "i386-pc-windows-msvc19.0.23918" 37 38%struct.S = type { i8 } 39 40$"\01??$fn_tmpl@H$1?bar@foo@@YAHH@Z@foo@@YAXXZ" = comdat any 41 42$"??6S@@QAEXH@Z" = comdat any 43 44; Function Attrs: nounwind 45define i32 @"\01?bar@foo@@YAHH@Z"(i32 %x) #0 !dbg !6 { 46entry: 47 %x.addr = alloca i32, align 4 48 store i32 %x, i32* %x.addr, align 4 49 call void @llvm.dbg.declare(metadata i32* %x.addr, metadata !11, metadata !12), !dbg !13 50 %0 = load i32, i32* %x.addr, align 4, !dbg !14 51 %mul = mul nsw i32 %0, 2, !dbg !15 52 ret i32 %mul, !dbg !16 53} 54 55; Function Attrs: nounwind readnone 56declare void @llvm.dbg.declare(metadata, metadata, metadata) #1 57 58; Function Attrs: nounwind 59define weak_odr void @"\01??$fn_tmpl@H$1?bar@foo@@YAHH@Z@foo@@YAXXZ"() #0 comdat !dbg !17 { 60entry: 61 ret void, !dbg !24 62} 63 64; Function Attrs: nounwind 65define linkonce_odr void @"??6S@@QAEXH@Z"(%struct.S* nonnull dereferenceable(1) %this, i32 %i) #0 !dbg !31 { 66entry: 67 %i.addr = alloca i32, align 4 68 %this.addr = alloca %struct.S*, align 4 69 store i32 %i, i32* %i.addr, align 4 70 store %struct.S* %this, %struct.S** %this.addr, align 4 71 %this1 = load %struct.S*, %struct.S** %this.addr, align 4 72 ret void, !dbg !32 73} 74 75attributes #0 = { nounwind "disable-tail-calls"="false" "less-precise-fpmad"="false" "frame-pointer"="all" "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" } 76attributes #1 = { nounwind readnone } 77 78!llvm.dbg.cu = !{!0} 79!llvm.module.flags = !{!3, !4} 80!llvm.ident = !{!5} 81 82!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) 83!1 = !DIFile(filename: "t.cpp", directory: "D:\5Csrc\5Cllvm\5Cbuild") 84!2 = !{} 85!3 = !{i32 2, !"CodeView", i32 1} 86!4 = !{i32 2, !"Debug Info Version", i32 3} 87!5 = !{!"clang version 3.9.0 "} 88!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, retainedNodes: !2) 89!7 = !DINamespace(name: "foo", scope: null) 90!8 = !DISubroutineType(types: !9) 91!9 = !{!10, !10} 92!10 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed) 93!11 = !DILocalVariable(name: "x", arg: 1, scope: !6, file: !1, line: 2, type: !10) 94!12 = !DIExpression() 95!13 = !DILocation(line: 2, column: 13, scope: !6) 96!14 = !DILocation(line: 2, column: 25, scope: !6) 97!15 = !DILocation(line: 2, column: 27, scope: !6) 98!16 = !DILocation(line: 2, column: 18, scope: !6) 99!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, retainedNodes: !2) 100!18 = !DISubroutineType(types: !19) 101!19 = !{null} 102!20 = !{!21, !22} 103!21 = !DITemplateTypeParameter(name: "T", type: !10) 104!22 = !DITemplateValueParameter(type: !23, value: i32 (i32)* @"\01?bar@foo@@YAHH@Z") 105!23 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !8, size: 32, align: 32) 106!24 = !DILocation(line: 4, column: 17, scope: !17) 107!25 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "S", file: !1, line: 7, size: 8, flags: DIFlagTypePassByValue, elements: !26, identifier: ".?AUS@@") 108!26 = !{!27} 109!27 = !DISubprogram(name: "operator<<", linkageName: "??6S@@QAEXH@Z", scope: !25, file: !1, line: 8, type: !28, scopeLine: 8, flags: DIFlagPrototyped, spFlags: 0) 110!28 = !DISubroutineType(cc: DW_CC_BORLAND_thiscall, types: !29) 111!29 = !{null, !30, !10} 112!30 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !25, size: 32, flags: DIFlagArtificial | DIFlagObjectPointer) 113!31 = distinct !DISubprogram(name: "operator<<", linkageName: "??6S@@QAEXH@Z", scope: !25, file: !1, line: 8, type: !28, scopeLine: 8, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !0, declaration: !27, retainedNodes: !2) 114!32 = !DILocation(line: 8, column: 27, scope: !31)