xref: /llvm-project/llvm/test/Assembler/dbg-record-invalid-0.ll (revision 464d9d96b3565ead06396ffb8d02b4dcf9cb9556)
1;; Test that we get a parser error when a debug record appears post-terminator.
2;; Note: From the parser's perspective, the error is that the debug record is
3;; appearing at the start of a new unnamed basic block which contains no actual
4;; instructions.
5; RUN: not llvm-as < %s 2>&1 | FileCheck %s
6; ModuleID = '<stdin>'
7source_filename = "<stdin>"
8
9define dso_local i32 @f(i32 %a) !dbg !7 {
10entry:
11  ret i32 %a, !dbg !18
12    #dbg_value(!DIArgList(i32 %a), !12, !DIExpression(), !14)
13; CHECK: <stdin>:[[@LINE+1]]:1: error: expected instruction opcode
14}
15
16!llvm.dbg.cu = !{!0}
17!llvm.module.flags = !{!3, !4, !5}
18!llvm.ident = !{!6}
19
20!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)
21!1 = !DIFile(filename: "print.c", directory: "/tmp")
22!2 = !{}
23!3 = !{i32 2, !"Dwarf Version", i32 5}
24!4 = !{i32 2, !"Debug Info Version", i32 3}
25!5 = !{i32 1, !"wchar_size", i32 4}
26!6 = !{!"clang version 18.0.0"}
27!7 = distinct !DISubprogram(name: "f", scope: !1, file: !1, line: 3, type: !8, scopeLine: 3, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !11)
28!8 = !DISubroutineType(types: !9)
29!9 = !{!10, !10}
30!10 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
31!11 = !{!12, !13}
32!12 = !DILocalVariable(name: "a", arg: 1, scope: !7, file: !1, line: 3, type: !10)
33!13 = !DILocalVariable(name: "b", scope: !7, file: !1, line: 3, type: !10)
34!14 = !DILocation(line: 3, column: 15, scope: !7)
35!15 = distinct !DIAssignID()
36!16 = !DILocation(line: 3, column: 20, scope: !7)
37!17 = !DILocation(line: 3, column: 25, scope: !7)
38!18 = !DILocation(line: 3, column: 30, scope: !7)
39