[PATCH] D87043: [Analyzer] Fix for dereferece of smart pointer after branching on unknown inner pointer
Artem Dergachev via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Sep 2 23:58:31 PDT 2020
NoQ added a comment.
Nice catch, thx!
================
Comment at: clang/lib/StaticAnalyzer/Checkers/SmartPtrModeling.cpp:106
const auto *InnerPointVal = State->get<TrackedRegionMap>(ThisRegion);
- return InnerPointVal && InnerPointVal->isZeroConstant();
+ return InnerPointVal && State->isNull(*InnerPointVal).isConstrainedTrue();
}
----------------
The intended ultimate test is `!State->assume(X)` and it's also much easier to write. I strongly suspect that we should remove these other APIs; they're only confusing.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D87043/new/
https://reviews.llvm.org/D87043
More information about the cfe-commits
mailing list