From 951c1a79316e798ae885f79a32f2846207b24d94 Mon Sep 17 00:00:00 2001 From: Simon Pilgrim Date: Wed, 2 Oct 2019 11:48:17 +0000 Subject: [PATCH] MetadataLoader upgradeCUVariables() - silence static analyzer dyn_cast_or_null<> null dereference warning. NFCI. The static analyzer is warning about a potential null dereference, but we know that the source won't be null so just use dyn_cast, which will assert if the value somehow is actually null. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@373448 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Bitcode/Reader/MetadataLoader.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Bitcode/Reader/MetadataLoader.cpp b/lib/Bitcode/Reader/MetadataLoader.cpp index 049164c7be7..4da51dda8b7 100644 --- a/lib/Bitcode/Reader/MetadataLoader.cpp +++ b/lib/Bitcode/Reader/MetadataLoader.cpp @@ -515,7 +515,7 @@ class MetadataLoader::MetadataLoaderImpl { GV.getMetadata(LLVMContext::MD_dbg, MDs); GV.eraseMetadata(LLVMContext::MD_dbg); for (auto *MD : MDs) - if (auto *DGV = dyn_cast_or_null(MD)) { + if (auto *DGV = dyn_cast(MD)) { auto *DGVE = DIGlobalVariableExpression::getDistinct( Context, DGV, DIExpression::get(Context, {})); GV.addMetadata(LLVMContext::MD_dbg, *DGVE); -- 2.40.0