[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:51:33 PDT 2025


================
@@ -1165,7 +1165,7 @@ ProgramStateRef StdLibraryFunctionsChecker::NotNullConstraint::apply(
   return State->assume(L, CannotBeNull);
 }
 
-void StdLibraryFunctionsChecker::NotNullConstraint::describe(
+void StdLibraryFunctionsChecker::NullnessConstraint::describe(
     DescriptionKind DK, const CallEvent &Call, ProgramStateRef State,
     const Summary &Summary, llvm::raw_ostream &Out) const {
   assert(CannotBeNull &&
----------------
ziqingluo-90 wrote:

The flag `CannotBeNull` controls whether this constraint is checking for null or non-null. But why `describe` function asserts `CannotBeNull` and below `describeArgumentValue` function asserts `!CannotBeNull`?

My understanding is that `describe` and `describeArgumentValue` are used to explain assumptions made by the checker to users during error reporting. I suppose both can be called in either case.

https://github.com/llvm/llvm-project/pull/131374


More information about the cfe-commits mailing list