[clang] [NFC][Static Analyzer] Rename and discuss about `NotNullConstraint` & `NotNullBufferConstraint` (PR #131374)

Ziqing Luo via cfe-commits cfe-commits at lists.llvm.org
Thu Mar 20 12:44:49 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:

ah, I see. It's called on the negation of the violated constraint! 

Then the only remaining question I have is that do you think `describe` and `describeArgumentValue` should be allowed to be called on any constraint?  For example, we cannot call `describe` on the `IsNull` constraint currently.   But since `IsNull` is used in making assumptions on post-conditions, I imagine one may be interested in adding a description note to a state/node explaining where the assumption comes from.  As far as I know, users sometimes struggle to understand where assumptions are made that eventually lead a path to an error.  So I'd like to leave some comments there for a future developer who might attempt to call `describe` on `IsNull`.  @balazske

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


More information about the cfe-commits mailing list