zaks.anna added inline comments.

================
Comment at: lib/StaticAnalyzer/Checkers/MallocChecker.cpp:810
+        if (CE->getNumArgs() == 2)
+          State = ProcessZeroAllocation(C, CE, 1, State);
       } else if (CE->getNumArgs() == 3) {
----------------
Why did you remove the old behavior here and below? 

I would expect this patch to be strictly additive. If gmalloc APIs take a 
different number of arguments, please, process them separately. You might need 
to factor out the processing code to avoid code duplication.



================
Comment at: lib/StaticAnalyzer/Checkers/MallocChecker.cpp:838
       State = ProcessZeroAllocation(C, CE, 1, State);
+      if (CE->getNumArgs() > 2)
+        State = ProcessZeroAllocation(C, CE, 2, State);
----------------
Should this be conditional on the number of arguments instead of adding two 
calls to ProcessZeroAllocation?


================
Comment at: lib/StaticAnalyzer/Checkers/MallocChecker.cpp:846
       State = ProcessZeroAllocation(C, CE, 0, State);
-      State = ProcessZeroAllocation(C, CE, 1, State);
-    } else if (FunI == II_free) {
+    } else if (FunI == II_free || FunI == II_g_free) {
       State = FreeMemAux(C, CE, State, 0, false, ReleasedAllocatedMemory);
----------------
This change in how calloc is handled broke the Analysis/malloc.c test.


Repository:
  rL LLVM

https://reviews.llvm.org/D28348



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

Reply via email to