[PATCH] D113164: [NFC] Avoid nullptr dereference
Kan Shengchen via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Nov 3 23:19:11 PDT 2021
skan added inline comments.
================
Comment at: llvm/lib/CodeGen/TypePromotion.cpp:207
bool TypePromotion::LessOrEqualTypeSize(Value *V) {
+ assert(!V);
return V->getType()->getScalarSizeInBits() <= TypeSize;
----------------
I don't know if this `assert` is necessary...
https://llvm.org/docs/CodingStandards.html#assert-liberally
The code standard suggests using the “assert” macro to its fullest. However I think the NULL ptr check can be omitted b/c we can get error message like "null pointer deference" at run time even w/o the assert.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D113164/new/
https://reviews.llvm.org/D113164
More information about the llvm-commits
mailing list