mirror of
https://github.com/RPCSX/llvm.git
synced 2024-11-27 05:30:49 +00:00
DebugInfo: Don't crash if 'Debug Info Version' has a strange value
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@229356 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
2b022d53a3
commit
3f58e9b36a
@ -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…
Reference in New Issue
Block a user