[PATCH] D69948: [Checkers] Added support for freopen to StreamChecker.

Balázs Kéri via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Nov 8 05:59:11 PST 2019


balazske marked 2 inline comments as done.
balazske added a comment.

I am still not sure in the `auto` type, I did not see that way of `auto` usage often in clang code.



================
Comment at: clang/lib/StaticAnalyzer/Checkers/StreamChecker.cpp:176
+  const LocationContext *LCtx = C.getPredecessor()->getLocationContext();
+  ConstraintManager &CM = C.getConstraintManager();
+  auto *CE = dyn_cast_or_null<CallExpr>(Call.getOriginExpr());
----------------
baloghadamsoftware wrote:
> The four lines above are typical cases for using auto, since the type is duplicated in the line. See: https://llvm.org/docs/CodingStandards.html#use-auto-type-deduction-to-make-code-more-readable
This is not totally clear if we can trust the pattern that at `auto X = Y.getXxx()` type of `X` will be `Xxx`.


================
Comment at: clang/test/Analysis/stream.c:120
+  fclose(p2); // expected-warning {{Try to close a file Descriptor already closed. Cause undefined behaviour}}
+}
+
----------------
baloghadamsoftware wrote:
> I wonder if this test belongs into this particular patch. It has nothing to do with `freopen()`.
I wanted to see if "aliasing" works because it happens in the freopen tests too. Probably this test is not needed?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D69948





More information about the cfe-commits mailing list