Szelethus created this revision.
Szelethus added reviewers: NoQ, george.karpenkov, baloghadamsoftware, rnkovacs.
Herald added subscribers: cfe-commits, mikhail.ramalho, a.sidorin, szepet, 
xazax.hun, whisperity.

Repository:
  rC Clang

https://reviews.llvm.org/D52969

Files:
  www/analyzer/alpha_checks.html
  www/analyzer/available_checks.html

Index: www/analyzer/available_checks.html
===================================================================
--- www/analyzer/available_checks.html
+++ www/analyzer/available_checks.html
@@ -543,7 +543,34 @@
 <colgroup><col class="namedescr"><col class="example"></colgroup>
 <thead><tr><td>Name, Description</td><td>Example</td></tr></thead>
 
+
 <tbody>
+<tr><td><div class="namedescr expandable"><span class="name">
+optin.cplusplus.VirtualCall</span><span class="lang">
+(C++)</span><div class="descr">
+Check virtual member function calls during construction or 
+destruction.</div></div></td>
+<td><div class="exampleContainer expandable">
+<div class="example"><pre>
+class A {
+public:
+  A() { 
+    f(); // warn
+  }
+  virtual void f();
+};
+</pre></div><div class="separator"></div>
+<div class="example"><pre>
+class A {
+public:
+  ~A() {
+    this-&gt;f(); // warn
+  }
+  virtual void f();
+};
+</pre></div></div></td></tr>
+
+
 <tr><td><div class="namedescr expandable"><span class="name">
 optin.mpi.MPI-Checker</span><span class="lang">
 (C)</span><div class="descr">
Index: www/analyzer/alpha_checks.html
===================================================================
--- www/analyzer/alpha_checks.html
+++ www/analyzer/alpha_checks.html
@@ -275,93 +275,192 @@
 </pre></div></div></td></tr>
 
 
+<tr><td><div class="namedescr expandable"><span class="name">
+alpha.core.StackAddressAsyncEscape</span><span class="lang">
+(C)</span><div class="descr">
+Check that addresses to stack memory do not escape the function that involves
+<code>dispatch_after</code> or <code>dispatch_async</code>. This checker is
+a part of core.StackAddressEscape, but is
+<a href=https://reviews.llvm.org/D41042>temporarily disabled</a> until some
+false positives are fixed.</div></div></td>
+<td><div class="exampleContainer expandable">
+<div class="example"><pre>
+dispatch_block_t test_block_inside_block_async_leak() {
+  int x = 123;
+  void (^inner)(void) = ^void(void) {
+    int y = x;
+    ++y; 
+  };
+  void (^outer)(void) = ^void(void) {
+    int z = x;
+    ++z;
+    inner(); 
+  }; 
+  return outer; // warn: address of stack-allocated block is captured by a
+                //       returned block
+}
+</pre></div></div></td></tr>
+
+
+</tbody></table>
+
+
 <tr><td><div class="namedescr expandable"><span class="name">
 alpha.core.TestAfterDivZero</span><span class="lang">
-(C, C++, ObjC)</span><div class="descr">
+(C++)</span><div class="descr">
 Check for division by variable that is later compared against 0. 
 Either the comparison is useless or there is division by zero.
 </div></div></td>
 <td><div class="exampleContainer expandable">
 <div class="example"><pre>
-void test(int x) {
-  var = 77 / x;
-  if (x == 0) { } // warn 
+void err_eq(int x) {
+  var = 77 / x; // note: Division with compared value made here
+  if (x == 0) { } // warn: value being compared against zero has already been
+                  //       used for division
 }
 </pre></div></div></td></tr>
 
-</tbody></table>
-
 <!-- =========================== cplusplus alpha =========================== -->
 <h3 id="cplusplus_alpha_checkers">C++ Alpha Checkers</h3>
 <table class="checkers">
 <colgroup><col class="namedescr"><col class="example"></colgroup>
 <thead><tr><td>Name, Description</td><td>Example</td></tr></thead>
-
 <tbody>
+
+
 <tr><td><div class="namedescr expandable"><span class="name">
-alpha.cplusplus.VirtualCall</span><span class="lang">
+alpha.cplusplus.DeleteWithNonVirtualDtor</span><span class="lang">
 (C++)</span><div class="descr">
-Check virtual member function calls during construction or 
-destruction.</div></div></td>
+Reports destructions of polymorphic objects with a non-virtual destructor in
+their base class
+</div></div></td>
 <td><div class="exampleContainer expandable">
 <div class="example"><pre>
-class A {
-public:
-  A() { 
-    f(); // warn
-  }
-  virtual void f();
-};
-</pre></div><div class="separator"></div>
+NonVirtual *create() {
+  NonVirtual *x = new NVDerived(); // note: conversion from derived to base
+                                   //       happened here
+  return x;
+}
+
+void sink(NonVirtual *x) {
+  delete x; // warn: destruction of a polymorphic object with no virtual
+            //       destructor
+}
+</pre></div></div></td></tr>
+
+
+<tr><td><div class="namedescr expandable"><span class="name">
+alpha.cplusplus.InvalidatedIterator</span><span class="lang">
+(C++)</span><div class="descr">
+Check for use of invalidated iterators.
+</div></div></td>
+<td><div class="exampleContainer expandable">
 <div class="example"><pre>
-class A {
-public:
-  ~A() {
-    this-&gt;f(); // warn
-  }
-  virtual void f();
+void bad_copy_assign_operator_list1(std::list<int> &L1,
+                                    const std::list<int> &L2) {
+  auto i0 = L1.cbegin();
+  L1 = L2;
+  *i0; // warn: invalidated iterator accessed
+}
+</pre></div></div></td></tr>
+
+
+<tr><td><div class="namedescr expandable"><span class="name">
+alpha.cplusplus.IteratorRange</span><span class="lang">
+(C++)</span><div class="descr">
+Check for iterators used outside their valid ranges.
+</div></div></td>
+<td><div class="exampleContainer expandable">
+<div class="example"><pre>
+void simple_bad_end(const std::vector<int> &v) {
+  auto i = v.end();
+  *i; // warn: iterator accessed outside of its range
+}
+</pre></div></div></td></tr>
+
+
+<tr><td><div class="namedescr expandable"><span class="name">
+alpha.cplusplus.MismatchedIterator</span><span class="lang">
+(C++)</span><div class="descr">
+Check for use of iterators of different containers where iterators of the same
+container are expected.
+</div></div></td>
+<td><div class="exampleContainer expandable">
+<div class="example"><pre>
+void bad_insert3(std::vector<int> &v1, std::vector<int> &v2) {
+  v2.insert(v1.cbegin(), v2.cbegin(), v2.cend()); // warn: container accessed
+                                                  //       using foreign
+                                                  //       iterator argument
+  v1.insert(v1.cbegin(), v1.cbegin(), v2.cend()); // warn: iterators of
+                                                  //       different containers
+                                                  //       used where the same
+                                                  //       container is
+                                                  //       expected
+  v1.insert(v1.cbegin(), v2.cbegin(), v1.cend()); // warn: iterators of
+                                                  //       different containers
+                                                  //       used where the same
+                                                  //       container is
+                                                  //       expected
+}
+</pre></div></div></td></tr>
+
+
+<tr><td><div class="namedescr expandable"><span class="name">
+alpha.cplusplus.MisusedMovedObject</span><span class="lang">
+(C++)</span><div class="descr">
+Method calls on a moved-from object and copying a moved-from object will be
+reported.
+</div></div></td>
+<td><div class="exampleContainer expandable">
+<div class="example"><pre>
+struct A {
+  void foo() {}
 };
+
+void f() {
+  A a;
+  A b = std::move(a); // note: 'a' became 'moved-from' here
+  a.foo();            // warn: method call on a 'moved-from' object 'a'
+}
 </pre></div></div></td></tr>
 
-<tbody>
+
 <tr><td><div class="namedescr expandable"><span class="name">
 alpha.cplusplus.UninitializedObject</span><span class="lang">
 (C++)</span><div class="descr">
-This checker reports uninitialized fields in objects created
-after a constructor call. It doesn't only find direct uninitialized
-fields, but rather makes a deep inspection of the object,
-analyzing all of it's fields subfields. <br>
-The checker regards inherited fields as direct fields, so one
-will recieve warnings for uninitialized inherited data members
-as well. <br>
+This checker reports uninitialized fields in objects created after a constructor
+call. It doesn't only find direct uninitialized fields, but rather makes a deep
+inspection of the object, analyzing all of it's fields subfields. <br>
+The checker regards inherited fields as direct fields, so one will recieve
+warnings for uninitialized inherited data members as well. <br>
 <br>
 It has several options:
 <ul>
   <li>
-    "<code>Pedantic</code>" (boolean). If its not set or is set to false, the checker
-    won't emit warnings for objects that don't have at least one initialized
-    field. This may be set with <br>
+    "<code>Pedantic</code>" (boolean). If its not set or is set to false, the
+    checker won't emit warnings for objects that don't have at least one
+    initialized field. This may be set with <br>
     <code>-analyzer-config alpha.cplusplus.UninitializedObject:Pedantic=true</code>.
   </li>
   <li>
-    "<code>NotesAsWarnings</code>" (boolean). If set to true, the checker will emit a
-    warning for each uninitalized field, as opposed to emitting one warning
-    per constructor call, and listing the uninitialized fields that belongs
-    to it in notes. Defaults to false. <br>
+    "<code>NotesAsWarnings</code>" (boolean). If set to true, the checker will
+    emit a warning for each uninitalized field, as opposed to emitting one
+    warning per constructor call, and listing the uninitialized fields that
+    belongs to it in notes. Defaults to false. <br>
     <code>-analyzer-config alpha.cplusplus.UninitializedObject:NotesAsWarnings=true</code>.
   </li>
   <li>
-    "<code>CheckPointeeInitialization</code>" (boolean). If set to false, the checker will
-    not analyze the pointee of pointer/reference fields, and will only check
-    whether the object itself is initialized. Defaults to false. <br>
+    "<code>CheckPointeeInitialization</code>" (boolean). If set to false, the
+    checker will not analyze the pointee of pointer/reference fields, and will
+    only check whether the object itself is initialized. Defaults to false. <br>
     <code>-analyzer-config alpha.cplusplus.UninitializedObject:CheckPointeeInitialization=true</code>.
   </li>
   <li>
-    "<code>IgnoreRecordsWithField</code>" (string). If supplied, the checker will not
-     analyze structures that have a field with a name or type name that
-     matches the given pattern. Defaults to <code>""</code>.
+    "<code>IgnoreRecordsWithField</code>" (string). If supplied, the checker
+    will not analyze structures that have a field with a name or type name that
+    matches the given pattern. Defaults to <code>""</code>.
 
-     <code>-analyzer-config alpha.cplusplus.UninitializedObject:IgnoreRecordsWithField="[Tt]ag|[Kk]ind"</code>.
+    <code>-analyzer-config alpha.cplusplus.UninitializedObject:IgnoreRecordsWithField="[Tt]ag|[Kk]ind"</code>.
   </li>
 </ul></div></div></td>
 <td><div class="exampleContainer expandable">
@@ -437,14 +536,10 @@
   A a(&b, &c); // warning: 3 uninitialized fields
                //          after the constructor call
 }
-<div class="example"><pre>
-
-
 </pre></div></div></td></tr>
 
-</tbody></table>
-
 
+</tbody></table>
 
 <!-- =============================== va_list =============================== -->
 <h3 id="valist_alpha_checkers">Variable Argument Alpha Checkers</h3>
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to