1 ; RUN: opt -jmc-instrument -mtriple=x86_64-pc-windows-msvc -S < %s | FileCheck %s
2 ; RUN: opt -jmc-instrument -mtriple=aarch64-pc-windows-msvc -S < %s | FileCheck %s
3 ; RUN: opt -jmc-instrument -mtriple=arm-pc-windows-msvc -S < %s | FileCheck %s
5 ; CHECK: $__JustMyCode_Default = comdat any
7 ; CHECK: @"__7DF23CF5_x@c" = internal unnamed_addr global i8 1, section ".msvcjmc", align 1, !dbg !0
8 ; CHECK: @llvm.used = appending global [1 x ptr] [ptr @__JustMyCode_Default], section "llvm.metadata"
9 ; CHECK: @"__A8764FDD_x@c" = internal unnamed_addr global i8 1, section ".msvcjmc", align 1, !dbg !5
10 ; CHECK: @"__0C712A50_x@c" = internal unnamed_addr global i8 1, section ".msvcjmc", align 1, !dbg !9
11 ; CHECK: @"__A3605329_x@c" = internal unnamed_addr global i8 1, section ".msvcjmc", align 1, !dbg !12
13 ; CHECK: define void @l1() !dbg !19 {
14 ; CHECK: call void @__CheckForDebuggerJustMyCode(ptr noundef @"__7DF23CF5_x@c")
18 ; CHECK: define void @l2() !dbg !23 {
19 ; CHECK: call void @__CheckForDebuggerJustMyCode(ptr noundef @"__7DF23CF5_x@c")
23 ; CHECK: define void @w1() !dbg !25 {
24 ; CHECK: call void @__CheckForDebuggerJustMyCode(ptr noundef @"__A8764FDD_x@c")
28 ; CHECK: define void @w2() !dbg !26 {
29 ; CHECK: call void @__CheckForDebuggerJustMyCode(ptr noundef @"__A8764FDD_x@c")
33 ; CHECK: define void @w3() !dbg !28 {
34 ; CHECK: call void @__CheckForDebuggerJustMyCode(ptr noundef @"__A8764FDD_x@c")
38 ; CHECK: define void @w4() !dbg !30 {
39 ; CHECK: call void @__CheckForDebuggerJustMyCode(ptr noundef @"__A8764FDD_x@c")
43 ; CHECK: define void @w5() !dbg !32 {
44 ; CHECK: call void @__CheckForDebuggerJustMyCode(ptr noundef @"__0C712A50_x@c")
48 ; CHECK: define void @w6() !dbg !33 {
49 ; CHECK: call void @__CheckForDebuggerJustMyCode(ptr noundef @"__A3605329_x@c")
53 ; CHECK: define void @w7() !dbg !34 {
54 ; CHECK: call void @__CheckForDebuggerJustMyCode(ptr noundef @"__0C712A50_x@c")
58 ; CHECK: define void @__JustMyCode_Default(ptr noundef %0) unnamed_addr comdat {
62 ; CHECK: declare void @__CheckForDebuggerJustMyCode(ptr noundef) unnamed_addr
64 ; CHECK: !llvm.linker.options = !{!18}
66 ; CHECK: !0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression())
67 ; CHECK: !1 = distinct !DIGlobalVariable(name: "__7DF23CF5_x@c", scope: !2, file: !3, type: !8, isLocal: true, isDefinition: true)
68 ; CHECK: !2 = distinct !DICompileUnit(language: DW_LANG_C99, file: !3, producer: "clang", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, globals: !4, splitDebugInlining: false, nameTableKind: None)
69 ; CHECK: !3 = !DIFile(filename: "a/x.c", directory: "/tmp")
70 ; CHECK: !4 = !{!0, !5, !9, !12}
71 ; CHECK: !5 = !DIGlobalVariableExpression(var: !6, expr: !DIExpression())
72 ; CHECK: !6 = distinct !DIGlobalVariable(name: "__A8764FDD_x@c", scope: !2, file: !7, type: !8, isLocal: true, isDefinition: true)
73 ; CHECK: !7 = !DIFile(filename: "./x.c", directory: "C:\\\\a\\\\b\\\\")
74 ; CHECK: !8 = !DIBasicType(name: "unsigned char", size: 8, encoding: DW_ATE_unsigned_char, flags: DIFlagArtificial)
75 ; CHECK: !9 = !DIGlobalVariableExpression(var: !10, expr: !DIExpression())
76 ; CHECK: !10 = distinct !DIGlobalVariable(name: "__0C712A50_x@c", scope: !2, file: !11, type: !8, isLocal: true, isDefinition: true)
77 ; CHECK: !11 = !DIFile(filename: "./b/.\\../b/x.c", directory: "a\\d/p")
78 ; CHECK: !12 = !DIGlobalVariableExpression(var: !13, expr: !DIExpression())
79 ; CHECK: !13 = distinct !DIGlobalVariable(name: "__A3605329_x@c", scope: !2, file: !14, type: !8, isLocal: true, isDefinition: true)
80 ; CHECK: !14 = !DIFile(filename: "./b/./../b/x.c", directory: "a/d/p")
81 ; CHECK: !15 = !{i32 2, !"CodeView", i32 1}
82 ; CHECK: !16 = !{i32 2, !"Debug Info Version", i32 3}
83 ; CHECK: !17 = !{!"clang"}
84 ; CHECK: !18 = !{!"/alternatename:__CheckForDebuggerJustMyCode=__JustMyCode_Default"}
85 ; CHECK: !19 = distinct !DISubprogram(name: "f", scope: !3, file: !3, line: 1, type: !20, scopeLine: 1, spFlags: DISPFlagDefinition, unit: !2, retainedNodes: !22)
86 ; CHECK: !20 = !DISubroutineType(types: !21)
87 ; CHECK: !21 = !{null}
89 ; CHECK: !23 = distinct !DISubprogram(name: "f", scope: !24, file: !24, line: 1, type: !20, scopeLine: 1, spFlags: DISPFlagDefinition, unit: !2, retainedNodes: !22)
90 ; CHECK: !24 = !DIFile(filename: "x.c", directory: "/tmp/a")
91 ; CHECK: !25 = distinct !DISubprogram(name: "f", scope: !7, file: !7, line: 1, type: !20, scopeLine: 1, spFlags: DISPFlagDefinition, unit: !2, retainedNodes: !22)
92 ; CHECK: !26 = distinct !DISubprogram(name: "f", scope: !27, file: !27, line: 1, type: !20, scopeLine: 1, spFlags: DISPFlagDefinition, unit: !2, retainedNodes: !22)
93 ; CHECK: !27 = !DIFile(filename: "./b\\x.c", directory: "C:\\\\a\\\\")
94 ; CHECK: !28 = distinct !DISubprogram(name: "f", scope: !29, file: !29, line: 1, type: !20, scopeLine: 1, spFlags: DISPFlagDefinition, unit: !2, retainedNodes: !22)
95 ; CHECK: !29 = !DIFile(filename: "./b/x.c", directory: "C:\\\\a\\\\")
96 ; CHECK: !30 = distinct !DISubprogram(name: "f", scope: !31, file: !31, line: 1, type: !20, scopeLine: 1, spFlags: DISPFlagDefinition, unit: !2, retainedNodes: !22)
97 ; CHECK: !31 = !DIFile(filename: "./b/./../b/x.c", directory: "C:/a")
98 ; CHECK: !32 = distinct !DISubprogram(name: "f", scope: !11, file: !11, line: 1, type: !20, scopeLine: 1, spFlags: DISPFlagDefinition, unit: !2, retainedNodes: !22)
99 ; CHECK: !33 = distinct !DISubprogram(name: "f", scope: !14, file: !14, line: 1, type: !20, scopeLine: 1, spFlags: DISPFlagDefinition, unit: !2, retainedNodes: !22)
100 ; CHECK: !34 = distinct !DISubprogram(name: "f", scope: !35, file: !35, line: 1, type: !20, scopeLine: 1, spFlags: DISPFlagDefinition, unit: !2, retainedNodes: !22)
101 ; CHECK: !35 = !DIFile(filename: "./b/./../b\\x.c", directory: "a/d/p")
103 ; All use the same flag
104 define void @l1() !dbg !20 {
107 define void @l2() !dbg !21 {
111 ; All use the same flag
112 define void @w1() !dbg !22 {
115 define void @w2() !dbg !23 {
118 define void @w3() !dbg !24 {
121 define void @w4() !dbg !25 {
125 ; Test relative paths
126 define void @w5() !dbg !26 {
129 define void @w6() !dbg !27 {
132 define void @w7() !dbg !28 {
137 !llvm.module.flags = !{!17, !18}
140 !0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, splitDebugInlining: false, nameTableKind: None)
141 !1 = !DIFile(filename: "a/x.c", directory: "/tmp")
142 !2 = !DIFile(filename: "x.c", directory: "/tmp/a")
143 !3 = !DIFile(filename: "./x.c", directory: "C:\\\\a\\\\b\\\\")
144 !4 = !DIFile(filename: "./b\\x.c", directory: "C:\\\\a\\\\")
145 !5 = !DIFile(filename: "./b/x.c", directory: "C:\\\\a\\\\")
146 !6 = !DIFile(filename: "./b/./../b/x.c", directory: "C:/a")
147 !7 = !DIFile(filename: "./b/.\\../b/x.c", directory: "a\\d/p")
148 !8 = !DIFile(filename: "./b/./../b/x.c", directory: "a/d/p")
149 !9 = !DIFile(filename: "./b/./../b\\x.c", directory: "a/d/p")
150 !17 = !{i32 2, !"CodeView", i32 1}
151 !18 = !{i32 2, !"Debug Info Version", i32 3}
153 !20 = distinct !DISubprogram(name: "f", scope: !1, file: !1, line: 1, type: !31, scopeLine: 1, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !33)
154 !21 = distinct !DISubprogram(name: "f", scope: !2, file: !2, line: 1, type: !31, scopeLine: 1, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !33)
155 !22 = distinct !DISubprogram(name: "f", scope: !3, file: !3, line: 1, type: !31, scopeLine: 1, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !33)
156 !23 = distinct !DISubprogram(name: "f", scope: !4, file: !4, line: 1, type: !31, scopeLine: 1, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !33)
157 !24 = distinct !DISubprogram(name: "f", scope: !5, file: !5, line: 1, type: !31, scopeLine: 1, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !33)
158 !25 = distinct !DISubprogram(name: "f", scope: !6, file: !6, line: 1, type: !31, scopeLine: 1, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !33)
159 !26 = distinct !DISubprogram(name: "f", scope: !7, file: !7, line: 1, type: !31, scopeLine: 1, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !33)
160 !27 = distinct !DISubprogram(name: "f", scope: !8, file: !8, line: 1, type: !31, scopeLine: 1, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !33)
161 !28 = distinct !DISubprogram(name: "f", scope: !9, file: !9, line: 1, type: !31, scopeLine: 1, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !33)
162 !31 = !DISubroutineType(types: !32)