r220911 - [analyzer] Updated tests for ZeroAllocDereference checker.

Anton Yartsev anton.yartsev at gmail.com
Thu Oct 30 08:16:26 PDT 2014


Author: ayartsev
Date: Thu Oct 30 10:16:26 2014
New Revision: 220911

URL: http://llvm.org/viewvc/llvm-project?rev=220911&view=rev
Log:
[analyzer] Updated tests for ZeroAllocDereference checker.

Modified:
    cfe/trunk/www/analyzer/potential_checkers.html

Modified: cfe/trunk/www/analyzer/potential_checkers.html
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/www/analyzer/potential_checkers.html?rev=220911&r1=220910&r2=220911&view=diff
==============================================================================
--- cfe/trunk/www/analyzer/potential_checkers.html (original)
+++ cfe/trunk/www/analyzer/potential_checkers.html Thu Oct 30 10:16:26 2014
@@ -461,12 +461,22 @@ unix.Malloc</span>.
 <p>Source: C++03 3.7.3.1p2; C++11 3.7.4.1p2.</p></div></div></td>
 <td><div class="exampleContainer expandable">
 <div class="example"><pre>
-int *p = malloc(0);
-*p = 1; // warn
+#include <memory>
+
+void test() {
+  int *p = (int *)malloc(0);
+  *p = 1; // warn
+  free(p);
+}
 </pre></div>
 <div class="example"><pre>
-int *p = new int{};
-int i = *p; // warn
+void f(int);
+
+void test() {
+  int *p = new int[0];
+  f(*p); // warn
+  delete[] p;
+}
 </pre></div></div></td>
 <td class="aligned"></td></tr>
 





More information about the cfe-commits mailing list