Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
clang/lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp | ||
---|---|---|
719 | Two lines below you are using the {0U} initialization syntax, and here the simple constructor call syntax. |
clang/lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp | ||
---|---|---|
188 | What does this do? Is it ever used in the patch? |
clang/lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp | ||
---|---|---|
188 | Yes, it is used. We use it in apply the value is passed to assume. | |
202 | Absolutely, yes, I should avoid lower case variables, will rename. | |
719 | Yes, definitely. I think I am going to use brace initialization syntax everywhere. | |
clang/test/Analysis/std-c-library-functions-arg-constraints.c | ||
76 | My understanding is that in case of fread, if buf is 0 then that is an undefined behavior. In the section in C11 describing the use of library functions (§7.1.4) it is stated that:
I've found more details in this StackOverflow post: Also note that a sane libc implementation would not dereference buf if size is 0, but we may not rely on these implementation details, that is why this is declared as undefined behavior in the standard. |
LGTM! Please address the nits before commiting, but there is no need for another round of reviews. :)
edit: from my end, that is.
clang/lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp | ||
---|---|---|
188 | Forgot my eyes in the office. Woops. I would still prefer a line of comment here :) | |
930–931 | Not super relevant to this specific revision, but shouldn't we leave these to StreamChecker? |
Yeah, and my first attempt was exactly to implement this with ranges. However, it failed when I realized that we cannot cast a pointer to NonLoc, so the already written RangeConstraint::apply* functions could not work (I would have to add another branch for handling Loc kind of SVals for the pointer case).
clang/lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp | ||
---|---|---|
188 | Ok, I added a comment about its role. | |
719 | Finally I ended up with the parens. :) | |
930–931 | Well, yeah we could remove fread and fwrite from the summaries entirely at some point, but that will require changing the test files here. |
What does this do? Is it ever used in the patch?