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