[PATCH] D148912: [Coverity] Fix explicit null dereferences
Kan Shengchen via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Apr 21 08:05:36 PDT 2023
skan added inline comments.
================
Comment at: llvm/include/llvm/ADT/SparseSet.h:206
assert(Idx < Universe && "Key out of range");
+ assert(Sparse != nullptr && "Invalid sparse type");
const unsigned Stride = std::numeric_limits<SparseT>::max() + 1u;
----------------
`Sparse != nullptr` -> `Sparse`
================
Comment at: llvm/include/llvm/CodeGen/PBQP/CostAllocator.h:103
EntrySet.insert(P.get());
- return PoolRef(std::move(P), &P->getValue());
}
----------------
I think it's a UB due to the sequence issue https://en.wikipedia.org/wiki/Sequence_point , right?
================
Comment at: llvm/include/llvm/CodeGen/SelectionDAGNodes.h:1138
inline unsigned SDValue::getOpcode() const {
+ assert(Node != nullptr && "Invalid Node");
return Node->getOpcode();
----------------
Why is this function special?
================
Comment at: llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp:1276
+ assert(MMI != nullptr && "Invalid machine module info");
if (MMI->hasDebugInfo() || TM.Options.ForceDwarfFrameSection)
----------------
`MMI != nullptr` -> `MMI`
================
Comment at: llvm/lib/CodeGen/ScheduleDAG.cpp:728
+ assert(TargetSU != nullptr && "Invalid target SUnit");
+ assert(SU != nullptr && "Invalid SUnit");
FixOrder();
----------------
Same here
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D148912/new/
https://reviews.llvm.org/D148912
More information about the llvm-commits
mailing list