[PATCH] D149160: [clang][analyzer] Handle special value AT_FDCWD in affected standard functions
Balázs Kéri via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Apr 27 00:57:59 PDT 2023
balazske marked 2 inline comments as done.
balazske added inline comments.
================
Comment at: clang/lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp:1988
+ return std::make_shared<RangeConstraint>(
+ ArgN, WithinRange, Range({AT_FDCWDv, AT_FDCWDv}, {0, IntMax}), "");
+ };
----------------
steakhal wrote:
> Should we define a specific constraint description?
> If not, then we should not specify it explicitly - given that it's already defined as an empty string by default.
Now a description is added. This looks better, but the user should know what is a "valid file descriptor" (is 0 allowed or not), it is not shown now.
================
Comment at: clang/lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp:1530-1541
+ // Get platform dependent values of some macros.
+ // Try our best to parse this from the Preprocessor, otherwise fallback to a
+ // default value (what is found in a library header).
+ auto GetMacroValue = [&C](const char *Name, int Default) -> RangeInt {
if (const std::optional<int> OptInt =
- tryExpandAsInteger("EOF", C.getPreprocessor()))
+ tryExpandAsInteger(Name, C.getPreprocessor()))
return *OptInt;
----------------
steakhal wrote:
> steakhal wrote:
> >
> What is your response @balazske?
This is much better.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D149160/new/
https://reviews.llvm.org/D149160
More information about the cfe-commits
mailing list