1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 03:02:36 +01:00
llvm-mirror/test/Verifier/unique-disubprogram.ll
Adrian Prantl 76f3fb45dc Add a verifier check that rejects non-distinct DISubprogram function
attachments. They would crash the backend, which expects all
DISubprograms that are not part of the type system to have a unit field.

Clang right before https://reviews.llvm.org/D79967 would generate this
kind of broken IR.

rdar://problem/69534688

Thanks to Fangrui for fixing an assembler test I had missed!

https://reviews.llvm.org/D88270
2020-09-25 12:04:46 -07:00

17 lines
771 B
LLVM

; RUN: llvm-as -disable-output <%s 2>&1| FileCheck %s
define i32 @_Z3foov() local_unnamed_addr !dbg !9 {
ret i32 5
}
!llvm.module.flags = !{!2}
!llvm.dbg.cu = !{!5}
!llvm.linker.options = !{}
!2 = !{i32 2, !"Debug Info Version", i32 3}
!5 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14, file: !6, producer: "clang", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug)
!6 = !DIFile(filename: "t.cpp", directory: "/")
!7 = !{}
; CHECK: function definition may only have a distinct !dbg attachment
; CHECK: warning: ignoring invalid debug info
!9 = !DISubprogram(name: "foo", linkageName: "_Z3foov", scope: !6, file: !6, line: 2, type: !11, flags: DIFlagPrototyped, spFlags: DISPFlagOptimized, retainedNodes: !7)
!11 = !DISubroutineType(types: !7)