[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:
Davide Italiano 2016-04-06 03:07:58 +00:00
parent 525c4ba52f
commit d7975248c1
2 changed files with 16 additions and 7 deletions

View File

@ -4376,6 +4376,7 @@ 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 (isa<DICompileUnit>(CU))
if (auto Ts = cast<DICompileUnit>(CU)->getRetainedTypes())
for (DIType *Op : Ts)
if (auto *T = dyn_cast_or_null<DICompositeType>(Op))

View 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: "")