[PATCH] D75063: [analyzer] StdLibraryFunctionsChecker: Add NotNull Arg Constraint
Balázs Kéri via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Mar 16 10:20:22 PDT 2020
balazske added inline comments.
================
Comment at: clang/lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp:189
+ ValueConstraintPtr negate() const override {
+ NotNullConstraint tmp(*this);
+ tmp.CannotBeNull = !this->CannotBeNull;
----------------
Is `Tmp` better name?
================
Comment at: clang/test/Analysis/std-c-library-functions-arg-constraints.c:59
+ fread(buf, sizeof(int), 10, fp); // expected-warning{{Function argument constraint is not satisfied}}
+}
----------------
One difficulty is that `fread` can work if the `buf` is 0 and `count` is 0 too. There is for sure code that uses this feature.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D75063/new/
https://reviews.llvm.org/D75063
More information about the cfe-commits
mailing list