================
@@ -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
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to