[llvm] r374788 - XCOFFObjectWriter - silence static analyzer dyn_cast<> null dereference warning. NFCI.
Simon Pilgrim via llvm-commits
llvm-commits at lists.llvm.org
Mon Oct 14 09:46:11 PDT 2019
Author: rksimon
Date: Mon Oct 14 09:46:11 2019
New Revision: 374788
URL: http://llvm.org/viewvc/llvm-project?rev=374788&view=rev
Log:
XCOFFObjectWriter - silence static analyzer dyn_cast<> null dereference warning. NFCI.
The static analyzer is warning about a potential null dereference, but we should be able to use cast<> directly and if not assert will fire for us.
Modified:
llvm/trunk/lib/MC/XCOFFObjectWriter.cpp
Modified: llvm/trunk/lib/MC/XCOFFObjectWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/XCOFFObjectWriter.cpp?rev=374788&r1=374787&r2=374788&view=diff
==============================================================================
--- llvm/trunk/lib/MC/XCOFFObjectWriter.cpp (original)
+++ llvm/trunk/lib/MC/XCOFFObjectWriter.cpp Mon Oct 14 09:46:11 2019
@@ -218,7 +218,7 @@ void XCOFFObjectWriter::executePostLayou
DenseMap<const MCSectionXCOFF *, ControlSection *> WrapperMap;
for (const auto &S : Asm) {
- const MCSectionXCOFF *MCSec = dyn_cast<const MCSectionXCOFF>(&S);
+ const auto *MCSec = cast<const MCSectionXCOFF>(&S);
assert(WrapperMap.find(MCSec) == WrapperMap.end() &&
"Cannot add a csect twice.");
More information about the llvm-commits
mailing list