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:
parent
271992a42e
commit
3ae73b8e74
@ -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;
|
||||
|
5
test/Assembler/invalid-debug-info-version.ll
Normal file
5
test/Assembler/invalid-debug-info-version.ll
Normal 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", !""}
|
Loading…
x
Reference in New Issue
Block a user