mirror of
https://github.com/RPCSX/llvm.git
synced 2025-01-23 12:45:47 +00:00
[IRVerifier] Avoid crashing on an invalid compile unit.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265514 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
525c4ba52f
commit
d7975248c1
@ -4376,13 +4376,14 @@ void Verifier::verifyTypeRefs() {
|
||||
// Visit all the compile units again to map the type references.
|
||||
SmallDenseMap<const MDString *, const DIType *, 32> TypeRefs;
|
||||
for (auto *CU : CUs->operands())
|
||||
if (auto Ts = cast<DICompileUnit>(CU)->getRetainedTypes())
|
||||
for (DIType *Op : Ts)
|
||||
if (auto *T = dyn_cast_or_null<DICompositeType>(Op))
|
||||
if (auto *S = T->getRawIdentifier()) {
|
||||
UnresolvedTypeRefs.erase(S);
|
||||
TypeRefs.insert(std::make_pair(S, T));
|
||||
}
|
||||
if (isa<DICompileUnit>(CU))
|
||||
if (auto Ts = cast<DICompileUnit>(CU)->getRetainedTypes())
|
||||
for (DIType *Op : Ts)
|
||||
if (auto *T = dyn_cast_or_null<DICompositeType>(Op))
|
||||
if (auto *S = T->getRawIdentifier()) {
|
||||
UnresolvedTypeRefs.erase(S);
|
||||
TypeRefs.insert(std::make_pair(S, T));
|
||||
}
|
||||
|
||||
// Verify debug info intrinsic bit piece expressions. This needs a second
|
||||
// pass through the intructions, since we haven't built TypeRefs yet when
|
||||
|
8
test/Verifier/dbg-invalid-compileunit.ll
Normal file
8
test/Verifier/dbg-invalid-compileunit.ll
Normal file
@ -0,0 +1,8 @@
|
||||
; RUN: not llvm-as -disable-output <%s 2>&1 | FileCheck %s
|
||||
; CHECK: assembly parsed, but does not verify
|
||||
|
||||
!llvm.module.flags = !{!0}
|
||||
!llvm.dbg.cu = !{!1}
|
||||
|
||||
!0 = !{i32 2, !"Debug Info Version", i32 3}
|
||||
!1 = !DIFile(filename: "davide.f", directory: "")
|
Loading…
x
Reference in New Issue
Block a user