[PATCH] D15921: [analyzer] Utility to match function calls.

Anna Zaks via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 7 14:56:30 PST 2016


zaks.anna added a comment.

> Side note: Has anybody ever considered just treating fopen and fclose like malloc and free?


Yes, there are a few checkers that follow the same open/close rule and could in theory be merged together.


================
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.
----------------
ariccio wrote:
> Why specify the RequiredArgs for `fclose`,  and not `fopen`?
Not sure. Maybe it's an omission.


Repository:
  rL LLVM

http://reviews.llvm.org/D15921





More information about the cfe-commits mailing list