mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2025-02-07 10:02:22 +00:00
Don't use dyn_cast_or_null if we know the pointer is nonnull.
Fix clang static analyzer null dereference warning by using dyn_cast instead.
This commit is contained in:
parent
498856fca5
commit
2e66405d8d
@ -1128,8 +1128,7 @@ struct MemorySanitizerVisitor : public InstVisitor<MemorySanitizerVisitor> {
|
||||
OriginAlignment);
|
||||
} else {
|
||||
Value *ConvertedShadow = convertToShadowTyNoVec(Shadow, IRB);
|
||||
Constant *ConstantShadow = dyn_cast_or_null<Constant>(ConvertedShadow);
|
||||
if (ConstantShadow) {
|
||||
if (auto *ConstantShadow = dyn_cast<Constant>(ConvertedShadow)) {
|
||||
if (ClCheckConstantShadow && !ConstantShadow->isZeroValue())
|
||||
paintOrigin(IRB, updateOrigin(Origin, IRB), OriginPtr, StoreSize,
|
||||
OriginAlignment);
|
||||
@ -1210,8 +1209,7 @@ struct MemorySanitizerVisitor : public InstVisitor<MemorySanitizerVisitor> {
|
||||
Value *ConvertedShadow = convertToShadowTyNoVec(Shadow, IRB);
|
||||
LLVM_DEBUG(dbgs() << " SHAD1 : " << *ConvertedShadow << "\n");
|
||||
|
||||
Constant *ConstantShadow = dyn_cast_or_null<Constant>(ConvertedShadow);
|
||||
if (ConstantShadow) {
|
||||
if (auto *ConstantShadow = dyn_cast<Constant>(ConvertedShadow)) {
|
||||
if (ClCheckConstantShadow && !ConstantShadow->isZeroValue()) {
|
||||
insertWarningFn(IRB, Origin);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user