xref: /llvm-project/llvm/test/Assembler/dbg-record-invalid-3.ll (revision 464d9d96b3565ead06396ffb8d02b4dcf9cb9556)
1;; Test that we get a parser error when a debug record appears in the same
2;; module as a debug intrinsic.
3; RUN: not llvm-as < %s 2>&1 | FileCheck %s
4; ModuleID = '<stdin>'
5source_filename = "<stdin>"
6
7define dso_local i32 @f(i32 %a) !dbg !7 {
8entry:
9  call void @llvm.dbg.value(metadata i32 %a, metadata !12, metadata !DIExpression()), !dbg !14
10; CHECK: <stdin>:[[@LINE+1]]:5: error: debug record should not appear in a module containing debug info intrinsics
11    #dbg_value(!DIArgList(i32 %a), !12, !DIExpression(), !14)
12  ret i32 %a, !dbg !18
13}
14
15declare void @llvm.dbg.value(metadata, metadata, metadata)
16
17!llvm.dbg.cu = !{!0}
18!llvm.module.flags = !{!3, !4, !5}
19!llvm.ident = !{!6}
20
21!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 18.0.0", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, nameTableKind: None)
22!1 = !DIFile(filename: "print.c", directory: "/tmp")
23!2 = !{}
24!3 = !{i32 2, !"Dwarf Version", i32 5}
25!4 = !{i32 2, !"Debug Info Version", i32 3}
26!5 = !{i32 1, !"wchar_size", i32 4}
27!6 = !{!"clang version 18.0.0"}
28!7 = distinct !DISubprogram(name: "f", scope: !1, file: !1, line: 3, type: !8, scopeLine: 3, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !11)
29!8 = !DISubroutineType(types: !9)
30!9 = !{!10, !10}
31!10 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
32!11 = !{!12, !13}
33!12 = !DILocalVariable(name: "a", arg: 1, scope: !7, file: !1, line: 3, type: !10)
34!13 = !DILocalVariable(name: "b", scope: !7, file: !1, line: 3, type: !10)
35!14 = !DILocation(line: 3, column: 15, scope: !7)
36!15 = distinct !DIAssignID()
37!16 = !DILocation(line: 3, column: 20, scope: !7)
38!17 = !DILocation(line: 3, column: 25, scope: !7)
39!18 = !DILocation(line: 3, column: 30, scope: !7)
40