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:
David Majnemer
2015-02-16 06:04:53 +00:00
parent 2b022d53a3
commit 3f58e9b36a
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;