[PATCH] D77066: [analyzer] ApiModeling: Add buffer size arg constraint
Kristóf Umann via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed May 6 04:48:12 PDT 2020
Szelethus added a comment.
I'm not familiar enough with `DynamicSize.cpp` to judge the changes there, but aside from a few nits, this LGTM.
================
Comment at: clang/lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp:249-250
+ // cannot apply the constraint. Actually, other checkers like
+ // CallAndMessage should catch this situation earlier, because we call a
+ // function with an uninitialized argument.
+ return nullptr;
----------------
Would an unreachable be appropriate here then?
================
Comment at: clang/lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp:993
+ RetType{IntTy}, EvalCallAsPure)
+ .ArgConstraint(BufferSize(0, 1)));
}
----------------
In most places, where we refer to an argument number, we use `ArgNo`. Is there a reason we don't do that here? Can we enforce greater type safety?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D77066/new/
https://reviews.llvm.org/D77066
More information about the cfe-commits
mailing list