llvm.org GIT mirror llvm / a39b1ce
Verifier: Disallow a line number without a file in DISubprogram A line number doesn't make much sense if you don't say where it's from. Add a verifier check for this and update some tests that had bogus debug info. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@295516 91177308-0d34-0410-b5e6-96231b3b80d8 Justin Bogner 2 years ago
9 changed file(s) with 26 addition(s) and 10 deletion(s). Raw diff Collapse all Expand all
10241024 AssertDI(isScope(N.getRawScope()), "invalid scope", &N, N.getRawScope());
10251025 if (auto *F = N.getRawFile())
10261026 AssertDI(isa(F), "invalid file", &N, F);
1027 else
1028 AssertDI(N.getLine() == 0, "line specified with no file", &N, N.getLine());
10271029 if (auto *T = N.getRawType())
10281030 AssertDI(isa(T), "invalid subroutine type", &N, T);
10291031 AssertDI(isType(N.getRawContainingType()), "invalid containing type", &N,
0 ; RUN: not llc -march=amdgcn -mcpu=tonga < %s 2>&1 | FileCheck -check-prefix=ERROR %s
11
2 ; ERROR: error: :1:42: in function rsq_legacy_f32 void (float addrspace(1)*, float): intrinsic not supported on subtarget
2 ; ERROR: error: foo.cl:1:42: in function rsq_legacy_f32 void (float addrspace(1)*, float): intrinsic not supported on subtarget
33
44 declare float @llvm.amdgcn.rsq.legacy(float) #0
55
2020 !2 = !{i32 2, !"Dwarf Version", i32 4}
2121 !3 = !{i32 2, !"Debug Info Version", i32 3}
2222 !4 = !DILocation(line: 1, column: 42, scope: !5)
23 !5 = distinct !DISubprogram(name: "rsq_legacy_f32", scope: null, line: 1, isLocal: false, isDefinition: true, scopeLine: 2, isOptimized: false, unit: !0)
23 !5 = distinct !DISubprogram(name: "rsq_legacy_f32", scope: null, file: !1, line: 1, isLocal: false, isDefinition: true, scopeLine: 2, isOptimized: false, unit: !0)
1212
1313 !0 = !DILocation(line: 571, column: 3, scope: !1)
1414 !1 = distinct !DILexicalBlock(line: 1, column: 1, file: !11, scope: !2)
15 !2 = distinct !DISubprogram(name: "foo", linkageName: "foo", line: 561, isLocal: false, isDefinition: true, virtualIndex: 6, isOptimized: false, unit: !3, scope: !3, type: !4)
15 !2 = distinct !DISubprogram(name: "foo", linkageName: "foo", file: !11, line: 561, isLocal: false, isDefinition: true, virtualIndex: 6, isOptimized: false, unit: !3, scope: !3, type: !4)
1616 !3 = distinct !DICompileUnit(language: DW_LANG_C99, producer: "clang 1.1", isOptimized: true, emissionKind: FullDebug, file: !11, enums: !12, retainedTypes: !12)
1717 !4 = !DISubroutineType(types: !5)
1818 !5 = !{!6}
2020 !0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, producer: "clang version 3.0 (trunk 137954)", isOptimized: true, emissionKind: FullDebug, file: !16, enums: !2, retainedTypes: !2, globals: !2)
2121 !1 = !{!2}
2222 !2 = !{}
23 !5 = distinct !DISubprogram(name: "bar", linkageName: "_Z3barN2N11AE", line: 4, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, unit: !0, scope: !6, type: !7)
23 !5 = distinct !DISubprogram(name: "bar", linkageName: "_Z3barN2N11AE", file: !16, line: 4, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, unit: !0, scope: !6, type: !7)
2424 !6 = !DIFile(filename: "n2.c", directory: "/private/tmp")
2525 !7 = !DISubroutineType(types: !8)
2626 !8 = !{null}
4040 !14 = !DILocalVariable(name: "caster", scope: !9, file: !1, line: 728, type: !15)
4141 !15 = distinct !DICompositeType(tag: DW_TAG_union_type, scope: !9, file: !1, line: 728, size: 64, align: 64, elements: !6, identifier: "someclass")
4242 !16 = distinct !DILocation(line: 87, column: 9, scope: !17)
43 !17 = distinct !DISubprogram(name: "foo", linkageName: "foo", scope: !10, line: 73, type: !11, isLocal: false, isDefinition: true, scopeLine: 74, flags: DIFlagPrototyped, isOptimized: true, unit: !0, declaration: !18, variables: !6)
43 !17 = distinct !DISubprogram(name: "foo", linkageName: "foo", scope: !10, file: !1, line: 73, type: !11, isLocal: false, isDefinition: true, scopeLine: 74, flags: DIFlagPrototyped, isOptimized: true, unit: !0, declaration: !18, variables: !6)
4444 !18 = !DISubprogram(name: "foo", linkageName: "foo", scope: !10, file: !1, line: 83, type: !11, isLocal: false, isDefinition: false, scopeLine: 83, flags: DIFlagPrototyped, isOptimized: true)
45
2323
2424 !0 = !{i32 2, !"Debug Info Version", i32 3}
2525 !1 = !DILocation(line: 8, scope: !2)
26 !2 = distinct !DISubprogram(name: "test", line: 3, isLocal: true, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, unit: !3, scopeLine: 3, scope: null)
26 !2 = distinct !DISubprogram(name: "test", file: !5, line: 3, isLocal: true, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, unit: !3, scopeLine: 3, scope: null)
2727 !3 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, producer: "clang version 3.5.0 ", isOptimized: false, emissionKind: LineTablesOnly, file: !5)
2828 !5 = !DIFile(filename: "test.c", directory: "")
7676 !6 = !{i32 2, !"Dwarf Version", i32 2}
7777 !7 = !{i32 2, !"Debug Info Version", i32 3}
7878 !8 = !DILocalVariable(name: "i", arg: 1, scope: !9, file: !3, line: 4, type: !5)
79 !9 = distinct !DISubprogram(name: "foo", linkageName: "foo", scope: !2, line: 4, type: !10, isLocal: false, isDefinition: true, virtualIndex: 6, isOptimized: false, unit: !2)!10 = !DISubroutineType(types: !11)!11 = !{!5, !5}!12 = !DIExpression()!13 = !DILocation(line: 5, scope: !14)!14 = distinct !DILexicalBlock(scope: !9, file: !3)!15 = !DILocation(line: 6, scope: !14)!16 = !DILocation(line: 7, scope: !14)!17 = !DILocation(line: 9, scope: !14)!18 = !DILocation(line: 11, scope: !14)!19 = !DILocation(line: 14, scope: !20)!20 = distinct !DILexicalBlock(scope: !21, file: !3)!21 = distinct !DISubprogram(name: "bar", linkageName: "bar", scope: !2, line: 13, type: !22, isLocal: false, isDefinition: true, virtualIndex: 6, isOptimized: false, unit: !2)!22 = !DISubroutineType(types: !23)!23 = !{!5}!24 = !DILocation(line: 15, scope: !20)!25 = !DILocation(line: 16, scope: !20)
79 !9 = distinct !DISubprogram(name: "foo", linkageName: "foo", scope: !2, file: !3, line: 4, type: !10, isLocal: false, isDefinition: true, virtualIndex: 6, isOptimized: false, unit: !2)!10 = !DISubroutineType(types: !11)!11 = !{!5, !5}!12 = !DIExpression()!13 = !DILocation(line: 5, scope: !14)!14 = distinct !DILexicalBlock(scope: !9, file: !3)!15 = !DILocation(line: 6, scope: !14)!16 = !DILocation(line: 7, scope: !14)!17 = !DILocation(line: 9, scope: !14)!18 = !DILocation(line: 11, scope: !14)!19 = !DILocation(line: 14, scope: !20)!20 = distinct !DILexicalBlock(scope: !21, file: !3)!21 = distinct !DISubprogram(name: "bar", linkageName: "bar", scope: !2, file: !3, line: 13, type: !22, isLocal: false, isDefinition: true, virtualIndex: 6, isOptimized: false, unit: !2)!22 = !DISubroutineType(types: !23)!23 = !{!5}!24 = !DILocation(line: 15, scope: !20)!25 = !DILocation(line: 16, scope: !20)
4040 !1 = !DIFile(filename: "a", directory: "b/")
4141 !3 = !{i32 2, !"Dwarf Version", i32 4}
4242 !4 = !{i32 2, !"Debug Info Version", i32 3}
43 !6 = distinct !DISubprogram(linkageName: "_Z3foov", scope: !1, line: 5, scopeLine: 5, unit: !0)
43 !6 = distinct !DISubprogram(linkageName: "_Z3foov", scope: !1, file: !1, line: 5, scopeLine: 5, unit: !0)
4444 !9 = !DILocation(line: 6, column: 3, scope: !6)
4545 !10 = !DILocation(line: 8, column: 5, scope: !11)
4646 !11 = distinct !DILexicalBlock(scope: !6, file: !1, line: 7, column: 7)
47 !12 = distinct !DISubprogram(linkageName: "_ZL3barv", scope: !1, line: 20, scopeLine: 20, unit: !0)
47 !12 = distinct !DISubprogram(linkageName: "_ZL3barv", scope: !1, file: !1, line: 20, scopeLine: 20, unit: !0)
0 ; RUN: not llvm-as -disable-output <%s 2>&1 | FileCheck %s
1 ; CHECK: assembly parsed, but does not verify
2 ; CHECK: line specified with no file
3
4 define void @foo() !dbg !3 {
5 ret void
6 }
7
8 !llvm.module.flags = !{!0}
9 !llvm.dbg.cu = !{!1}
10
11 !0 = !{i32 2, !"Debug Info Version", i32 3}
12 !1 = distinct !DICompileUnit(language: DW_LANG_C, file: !2)
13 !2 = !DIFile(filename: "foo.c", directory: "")
14 !3 = distinct !DISubprogram(name: "foo", scope: !1, line: 1, unit: !1)