[clang] [NFC][Static Analyzer] Rename and discuss about `NotNullConstraint` & `NotNullBufferConstraint` (PR #131374)
Ziqing Luo via cfe-commits
cfe-commits at lists.llvm.org
Fri Mar 14 11:53:21 PDT 2025
================
@@ -436,9 +436,9 @@ class StdLibraryFunctionsChecker
llvm::raw_ostream &Out) const override;
ValueConstraintPtr negate() const override {
- NotNullBufferConstraint Tmp(*this);
+ BufferNullnessConstraint Tmp(*this);
Tmp.CannotBeNull = !this->CannotBeNull;
----------------
ziqingluo-90 wrote:
The negation of the constraint does not fully match my expectation: this constraint is saying `size == 0 || buf != 0`. So the negation is suppose to be `size != 0 && buf == 0`. The implementation looks more like `size == 0 || buf == 0` to me.
In general, how is the negation of a constraint used? I imagine that sometimes the engine needs to split the path by assuming '_C_' and '!_C_' for a constraint '_C_'? If the negation can be used as an assumption for a path, we should be serious about its correctness. Additionally, `describe` and `describeArgumentValue` need to report differently depending on whether the constraint is negated or not.
https://github.com/llvm/llvm-project/pull/131374
More information about the cfe-commits
mailing list