[PATCH] D149160: [clang][analyzer] Handle special value AT_FDCWD in affected standard functions

Balázs Benics via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Apr 27 00:03:52 PDT 2023


steakhal 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}), "");
+    };
----------------
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.


================
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:
> 
What is your response @balazske?


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