DebugInfo: Don't crash if 'Debug Info Version' has a strange value
llvm-svn: 229356
diff --git a/llvm/lib/IR/DebugInfo.cpp b/llvm/lib/IR/DebugInfo.cpp
index 31f1e19..deeaae7 100644
--- a/llvm/lib/IR/DebugInfo.cpp
+++ b/llvm/lib/IR/DebugInfo.cpp
@@ -1537,7 +1537,7 @@
}
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;