Require DISubprogram metadata to carry a non-null type in the verifier. LangRef specifies that the `type:` field of `DISubprogram` points to a `DISubroutineType`. This patch diagnoses malformed debug info where the field is omitted or resolves to null, while preserving the existing wrong-type diagnostic for non-DISubroutineType operands. Update hand-written LLVM IR tests to use valid DISubprogram metadata where they are not intentionally testing malformed debug info. These tests now use minimal DISubroutineType metadata so the new verifier check does not mask their original coverage. Fixes #186557
20 lines
930 B
LLVM
20 lines
930 B
LLVM
; RUN: llvm-as -disable-output %s 2>&1 | FileCheck %s
|
|
|
|
; Make sure we emit this diagnostic only once (which means we don't visit the
|
|
; same DISubprogram twice.
|
|
; CHECK: subprogram definitions must have a compile unit
|
|
; CHECK-NEXT: !3 = distinct !DISubprogram(name: "patatino", scope: null, type: !4, spFlags: DISPFlagDefinition)
|
|
; CHECK-NOT: subprogram definitions must have a compile unit
|
|
; CHECK-NOT: !3 = distinct !DISubprogram(name: "patatino", scope: null, type: !4, spFlags: DISPFlagDefinition)
|
|
; CHECK: warning: ignoring invalid debug info
|
|
|
|
define void @tinkywinky() !dbg !3 { ret void }
|
|
|
|
!llvm.module.flags = !{!6}
|
|
!llvm.dbg.cu = !{!0}
|
|
!0 = distinct !DICompileUnit(language: 12, file: !1)
|
|
!1 = !DIFile(filename: "/home/davide", directory: "/home/davide")
|
|
!3 = distinct !DISubprogram(name: "patatino", isDefinition: true, type: !4)
|
|
!4 = !DISubroutineType(types: !5)
|
|
!5 = !{null}
|
|
!6 = !{i32 2, !"Debug Info Version", i32 3}
|