[PATCH] D77148: [analyzer] ApiModeling: Add buffer size arg constraint with multiplier involved
Gabor Marton via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue May 5 06:58:23 PDT 2020
martong marked 3 inline comments as done.
martong added inline comments.
================
Comment at: clang/lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp:229-234
BufferSizeConstraint(ArgNo BufArgN, ArgNo SizeArgN)
: ValueConstraint(BufArgN), SizeArgN(SizeArgN) {}
+ BufferSizeConstraint(ArgNo BufArgN, ArgNo SizeArgN, ArgNo SizeMulArgN)
+ : ValueConstraint(BufArgN), SizeArgN(SizeArgN),
+ SizeMultiplierArgN(SizeMulArgN) {}
----------------
Szelethus wrote:
> I don't know, these constructors don't look overly talkative.
Yeah, renamed the params a bit.
================
Comment at: clang/lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp:1041
+ EvalCallAsPure)
+ .ArgConstraint(BufferSize(0, 1, 2))}},
};
----------------
Szelethus wrote:
> So this is supposed to mean that the 1st argument has the size of the argument of 2nd argument times the 3rd argument? Unlike the other summaries, this feels a bit cryptic. Something like this might look better:
> ```lang=c++
> .ArgConstraint(0, BufferSize(/*BufSize*/1, /*BufSizeMultiplier*/))
> .ArgConstraint(BufferSize(/*Buffer*/0, /*BufSize*/1, /*BufSizeMultiplier*/2))
> .ArgConstraint(0, BufferSizeMul(1, 2))
> ```
> WDYT?
Ok, I updated with the 2nd option. :)
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D77148/new/
https://reviews.llvm.org/D77148
More information about the cfe-commits
mailing list