This time, we add contraints to functions that either return with [0, -1] or with a file descriptor.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
It must have been a tedious task to collect all these - without any copy-paste errors, really impressive!
It's good to go, however, if you don't mind there would be some readability issues yet to solve in a later path in the inline comments.
clang/lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp | ||
---|---|---|
1367–1368 | I think you should hoist this ArgumentCondition construction with a lambda call. It would lead to more readable summaries. const auto ValidFileDescriptorArgAt = [](unsigned ArgIdx) { return ArgumentCondition(ArgIdx, WithinRange, Range(0, IntMax)))); }; Probably the very same principle would apply for handling off_t arguments. You can probably find a better name, but you get the idea. | |
1888 | The same principle applies here too. | |
1905 | It's a sane overapproximation. Perfectly fine for us. |
One more thing.
Please reflow the path's summary, to keep the range constraint in a single line.
Thanks for the review!
clang/lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp | ||
---|---|---|
1367–1368 | Good idea, thanks! I am going to create another patch for this (and another for exec* functions). |
I think you should hoist this ArgumentCondition construction with a lambda call. It would lead to more readable summaries.
Probably the very same principle would apply for handling off_t arguments.
You can probably find a better name, but you get the idea.
If you agree on this, you could create a follow-up patch.