xref: /llvm-project/llvm/test/Verifier/metadata-function-dbg.ll (revision 41d5033eb162cb92b684855166cabfa3983b74c6)
1; RUN: llvm-as %s -disable-output 2>&1 | FileCheck %s
2
3; CHECK:      function declaration may only have a unique !dbg attachment
4declare !dbg !4 void @f1()
5
6; CHECK-NOT:      function declaration may only have a unique !dbg attachment
7declare !dbg !6 void @f5()
8
9; CHECK:      function must have a single !dbg attachment
10define void @f2() !dbg !4 !dbg !4 {
11  unreachable
12}
13
14; CHECK:      DISubprogram attached to more than one function
15define void @f3() !dbg !4 {
16  unreachable
17}
18
19; CHECK:      DISubprogram attached to more than one function
20define void @f4() !dbg !4 {
21  unreachable
22}
23
24; CHECK-NOT:  !dbg
25; CHECK:      function !dbg attachment must be a subprogram
26; CHECK-NEXT: ptr @bar
27; CHECK-NEXT: !{{[0-9]+}} = !{}
28define void @bar() !dbg !3 {
29  unreachable
30}
31
32; CHECK: warning: ignoring invalid debug info
33!llvm.module.flags = !{!0}
34!0 = !{i32 2, !"Debug Info Version", i32 3}
35
36!llvm.dbg.cu = !{!1}
37!1 = distinct !DICompileUnit(language: DW_LANG_C99, file: !2, retainedTypes: !5)
38!2 = !DIFile(filename: "t.c", directory: "/path/to/dir")
39!3 = !{}
40!4 = distinct !DISubprogram(name: "foo", scope: !1, file: !2, unit: !1)
41!5 = !{!6}
42!6 = !DISubprogram(name: "f5", scope: !1, file: !2, unit: !1, flags: DIFlagPrototyped, spFlags: DISPFlagOptimized)
43