steakhal added inline comments.

================
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;
----------------



================
Comment at: 
clang/lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp:2137-2138
             .Case(ReturnsMinusOne, ErrnoNEZeroIrrelevant)
+            .ArgConstraint(ArgumentCondition(
+                0, WithinRange, Range({AT_FDCWDv, AT_FDCWDv}, {0, IntMax})))
             .ArgConstraint(NotNull(ArgNo(1))));
----------------
I think I would recommend hoisting this common subexpression. This would save 
repetition on subsequent occurrences.

```lang=C++
const auto ValidDescriptorOrAtCWDRange = Range({AT_FDCWDv, AT_FDCWDv}, {0, 
IntMax});
```

You can explore if hoisting the whole `ArgumentCondition` would make it even 
more readable.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D149160/new/

https://reviews.llvm.org/D149160

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to