[llvm] r372966 - MetadataLoader lazyLoadOneMetadata - silence static analyzer dyn_cast<MDNode> null dereference warning. NFCI.
Simon Pilgrim via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 26 04:30:48 PDT 2019
Author: rksimon
Date: Thu Sep 26 04:30:47 2019
New Revision: 372966
URL: http://llvm.org/viewvc/llvm-project?rev=372966&view=rev
Log:
MetadataLoader lazyLoadOneMetadata - silence static analyzer dyn_cast<MDNode> null dereference warning. NFCI.
The static analyzer is warning about a potential null dereference, but we should be able to use cast<MDNode> directly and if not assert will fire for us.
Modified:
llvm/trunk/lib/Bitcode/Reader/MetadataLoader.cpp
Modified: llvm/trunk/lib/Bitcode/Reader/MetadataLoader.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Bitcode/Reader/MetadataLoader.cpp?rev=372966&r1=372965&r2=372966&view=diff
==============================================================================
--- llvm/trunk/lib/Bitcode/Reader/MetadataLoader.cpp (original)
+++ llvm/trunk/lib/Bitcode/Reader/MetadataLoader.cpp Thu Sep 26 04:30:47 2019
@@ -987,7 +987,7 @@ void MetadataLoader::MetadataLoaderImpl:
assert(ID >= MDStringRef.size() && "Unexpected lazy-loading of MDString");
// Lookup first if the metadata hasn't already been loaded.
if (auto *MD = MetadataList.lookup(ID)) {
- auto *N = dyn_cast_or_null<MDNode>(MD);
+ auto *N = cast<MDNode>(MD);
if (!N->isTemporary())
return;
}
More information about the llvm-commits
mailing list