ariccio added a subscriber: ariccio. ariccio added a comment. Side note: Has anybody ever considered just treating `fopen` and `fclose` like `malloc` and `free`?
On Windows I use a trick that I discovered what I call "the `_Post_ptr_invalid_` hack" because* the `_Post_ptr_invalid_` SAL annotation lets me treat the argument to `CloseHandle` like the argument to `free`, and reports double closes as double frees. Here we'd just treat the `FILE*` as a different region of memory, to check that they're not mixed. - this also works in part because a Windows `HANDLE` is just a `typedef`d `void*` ================ Comment at: cfe/trunk/lib/StaticAnalyzer/Checkers/SimpleStreamChecker.cpp:106 @@ -108,3 +105,3 @@ SimpleStreamChecker::SimpleStreamChecker() - : IIfopen(nullptr), IIfclose(nullptr) { + : OpenFn("fopen"), CloseFn("fclose", 1) { // Initialize the bug types. ---------------- Why specify the RequiredArgs for `fclose`, and not `fopen`? Repository: rL LLVM http://reviews.llvm.org/D15921 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits