1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2025-01-31 12:41:49 +01:00

DebugInfo: Don't crash if 'Debug Info Version' has a strange value

llvm-svn: 229356
This commit is contained in:
David Majnemer 2015-02-16 06:04:53 +00:00
parent 271992a42e
commit 3ae73b8e74
2 changed files with 6 additions and 1 deletions

View File

@ -1537,7 +1537,7 @@ bool llvm::StripDebugInfo(Module &M) {
}
unsigned llvm::getDebugMetadataVersionFromModule(const Module &M) {
if (auto *Val = mdconst::extract_or_null<ConstantInt>(
if (auto *Val = mdconst::dyn_extract_or_null<ConstantInt>(
M.getModuleFlag("Debug Info Version")))
return Val->getZExtValue();
return 0;

View File

@ -0,0 +1,5 @@
; RUN: opt < %s -S | FileCheck %s
!llvm.module.flags = !{!0}
!0 = !{i32 1, !"Debug Info Version", !""}
; CHECK: !{i32 1, !"Debug Info Version", !""}