[PATCH] D58573: [analyzer] Move UninitializedObjectChecker out of alpha

2019-05-04 Thread Dmitri Gribenko via Phabricator via cfe-commits
gribozavr added a comment.

Thank you for the fixes!  Another crash: 
https://bugs.llvm.org/show_bug.cgi?id=41741


Repository:
  rC Clang

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D58573/new/

https://reviews.llvm.org/D58573



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


[PATCH] D58573: [analyzer] Move UninitializedObjectChecker out of alpha

2019-04-27 Thread Sylvestre Ledru via Phabricator via cfe-commits
sylvestre.ledru added a comment.

I took the liberty to add that in the release notes of clang
https://reviews.llvm.org/rG5f163c7e2e62


Repository:
  rC Clang

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D58573/new/

https://reviews.llvm.org/D58573



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


[PATCH] D58573: [analyzer] Move UninitializedObjectChecker out of alpha

2019-04-26 Thread Kristóf Umann via Phabricator via cfe-commits
Szelethus added a comment.

I suspect the problem is similar. I'll take a look at this either today or 
tomorrow, thanks!


Repository:
  rC Clang

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D58573/new/

https://reviews.llvm.org/D58573



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


[PATCH] D58573: [analyzer] Move UninitializedObjectChecker out of alpha

2019-04-26 Thread Dmitri Gribenko via Phabricator via cfe-commits
gribozavr added a comment.

Thank you for the fix!  Another crash: 
https://bugs.llvm.org/show_bug.cgi?id=41611


Repository:
  rC Clang

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D58573/new/

https://reviews.llvm.org/D58573



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


[PATCH] D58573: [analyzer] Move UninitializedObjectChecker out of alpha

2019-04-24 Thread Kristóf Umann via Phabricator via cfe-commits
Szelethus added a comment.

In D58573#1477581 , @gribozavr wrote:

> Thanks for the checker!  We are hitting a crash on `_Atomic` fields, could 
> you take a look?  https://bugs.llvm.org/show_bug.cgi?id=41590  Thanks!


Yup, consider it fixed (in a little while)! Thanks for the report!


Repository:
  rC Clang

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D58573/new/

https://reviews.llvm.org/D58573



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


[PATCH] D58573: [analyzer] Move UninitializedObjectChecker out of alpha

2019-04-24 Thread Dmitri Gribenko via Phabricator via cfe-commits
gribozavr added a comment.

Thanks for the checker!  We are hitting a crash on `_Atomic` fields, could you 
take a look?  https://bugs.llvm.org/show_bug.cgi?id=41590  Thanks!


Repository:
  rC Clang

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D58573/new/

https://reviews.llvm.org/D58573



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


[PATCH] D58573: [analyzer] Move UninitializedObjectChecker out of alpha

2019-04-19 Thread Kristóf Umann via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rC358797: [analyzer] Move UninitializedObjectChecker out of 
alpha (authored by Szelethus, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D58573?vs=194667=195937#toc

Repository:
  rC Clang

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D58573/new/

https://reviews.llvm.org/D58573

Files:
  docs/analyzer/checkers.rst
  include/clang/StaticAnalyzer/Checkers/Checkers.td
  lib/StaticAnalyzer/Checkers/UninitializedObject/UninitializedObject.h
  test/Analysis/cxx-uninitialized-object-inheritance.cpp
  test/Analysis/cxx-uninitialized-object-no-dereference.cpp
  test/Analysis/cxx-uninitialized-object-notes-as-warnings.cpp
  test/Analysis/cxx-uninitialized-object-ptr-ref.cpp
  test/Analysis/cxx-uninitialized-object-unguarded-access.cpp
  test/Analysis/cxx-uninitialized-object-unionlike-constructs.cpp
  test/Analysis/cxx-uninitialized-object.cpp
  test/Analysis/objcpp-uninitialized-object.mm
  www/analyzer/alpha_checks.html
  www/analyzer/available_checks.html

Index: include/clang/StaticAnalyzer/Checkers/Checkers.td
===
--- include/clang/StaticAnalyzer/Checkers/Checkers.td
+++ include/clang/StaticAnalyzer/Checkers/Checkers.td
@@ -493,6 +493,43 @@
 
 let ParentPackage = CplusplusOptIn in {
 
+def UninitializedObjectChecker: Checker<"UninitializedObject">,
+  HelpText<"Reports uninitialized fields after object construction">,
+  CheckerOptions<[
+CmdLineOption,
+CmdLineOption,
+CmdLineOption,
+CmdLineOption,
+CmdLineOption
+  ]>,
+  Documentation;
+
 def VirtualCallChecker : Checker<"VirtualCall">,
   HelpText<"Check virtual function calls during construction or destruction">,
   CheckerOptions<[
@@ -536,43 +573,6 @@
   Dependencies<[IteratorModeling]>,
   Documentation;
 
-def UninitializedObjectChecker: Checker<"UninitializedObject">,
-  HelpText<"Reports uninitialized fields after object construction">,
-  CheckerOptions<[
-CmdLineOption,
-CmdLineOption,
-CmdLineOption,
-CmdLineOption,
-CmdLineOption
-  ]>,
-  Documentation;
-
 } // end: "alpha.cplusplus"
 
 
Index: test/Analysis/cxx-uninitialized-object-ptr-ref.cpp
===
--- test/Analysis/cxx-uninitialized-object-ptr-ref.cpp
+++ test/Analysis/cxx-uninitialized-object-ptr-ref.cpp
@@ -1,10 +1,10 @@
-// RUN: %clang_analyze_cc1 -analyzer-checker=core,alpha.cplusplus.UninitializedObject \
-// RUN:   -analyzer-config alpha.cplusplus.UninitializedObject:Pedantic=true -DPEDANTIC \
-// RUN:   -analyzer-config alpha.cplusplus.UninitializedObject:CheckPointeeInitialization=true \
+// RUN: %clang_analyze_cc1 -analyzer-checker=core,optin.cplusplus.UninitializedObject \
+// RUN:   -analyzer-config optin.cplusplus.UninitializedObject:Pedantic=true -DPEDANTIC \
+// RUN:   -analyzer-config optin.cplusplus.UninitializedObject:CheckPointeeInitialization=true \
 // RUN:   -std=c++11 -verify  %s
 
-// RUN: %clang_analyze_cc1 -analyzer-checker=core,alpha.cplusplus.UninitializedObject \
-// RUN:   -analyzer-config alpha.cplusplus.UninitializedObject:CheckPointeeInitialization=true \
+// RUN: %clang_analyze_cc1 -analyzer-checker=core,optin.cplusplus.UninitializedObject \
+// RUN:   -analyzer-config optin.cplusplus.UninitializedObject:CheckPointeeInitialization=true \
 // RUN:   -std=c++11 -verify  %s
 
 //===--===//
Index: test/Analysis/cxx-uninitialized-object-notes-as-warnings.cpp
===
--- test/Analysis/cxx-uninitialized-object-notes-as-warnings.cpp
+++ test/Analysis/cxx-uninitialized-object-notes-as-warnings.cpp
@@ -1,6 +1,6 @@
-// RUN: %clang_analyze_cc1 -analyzer-checker=core,alpha.cplusplus.UninitializedObject \
-// RUN:   -analyzer-config alpha.cplusplus.UninitializedObject:NotesAsWarnings=true \
-// RUN:   -analyzer-config alpha.cplusplus.UninitializedObject:CheckPointeeInitialization=true \
+// RUN: %clang_analyze_cc1 -analyzer-checker=core,optin.cplusplus.UninitializedObject \
+// RUN:   -analyzer-config optin.cplusplus.UninitializedObject:NotesAsWarnings=true \
+// RUN:   -analyzer-config optin.cplusplus.UninitializedObject:CheckPointeeInitialization=true \
 // RUN:   -std=c++11 -verify %s
 
 class NotesAsWarningsTest {
Index: test/Analysis/objcpp-uninitialized-object.mm
===
--- test/Analysis/objcpp-uninitialized-object.mm
+++ test/Analysis/objcpp-uninitialized-object.mm
@@ -1,4 +1,4 @@
-// RUN: %clang_analyze_cc1 -analyzer-checker=core,alpha.cplusplus.UninitializedObject -std=c++11 -fblocks -verify %s
+// RUN: %clang_analyze_cc1 -analyzer-checker=core,optin.cplusplus.UninitializedObject -std=c++11 -fblocks -verify %s
 
 typedef void (^myBlock) ();
 
Index: test/Analysis/cxx-uninitialized-object.cpp

[PATCH] D58573: [analyzer] Move UninitializedObjectChecker out of alpha

2019-04-19 Thread Artem Dergachev via Phabricator via cfe-commits
NoQ accepted this revision.
NoQ added a comment.
This revision is now accepted and ready to land.

Ouch, forgot to accept it. Here you go!


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D58573/new/

https://reviews.llvm.org/D58573



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


[PATCH] D58573: [analyzer] Move UninitializedObjectChecker out of alpha

2019-04-19 Thread Kristóf Umann via Phabricator via cfe-commits
Szelethus added a comment.

Gentle ping.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D58573/new/

https://reviews.llvm.org/D58573



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


[PATCH] D58573: [analyzer] Move UninitializedObjectChecker out of alpha

2019-04-11 Thread Kristóf Umann via Phabricator via cfe-commits
Szelethus updated this revision to Diff 194667.
Szelethus retitled this revision from "[analyzer] Move UninitializedObject out 
of alpha" to "[analyzer] Move UninitializedObjectChecker out of alpha".
Szelethus added a comment.

Moved the checker to `optin.cplusplus`.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D58573/new/

https://reviews.llvm.org/D58573

Files:
  docs/analyzer/checkers.rst
  include/clang/StaticAnalyzer/Checkers/Checkers.td
  lib/StaticAnalyzer/Checkers/UninitializedObject/UninitializedObject.h
  test/Analysis/cxx-uninitialized-object-inheritance.cpp
  test/Analysis/cxx-uninitialized-object-no-dereference.cpp
  test/Analysis/cxx-uninitialized-object-notes-as-warnings.cpp
  test/Analysis/cxx-uninitialized-object-ptr-ref.cpp
  test/Analysis/cxx-uninitialized-object-unguarded-access.cpp
  test/Analysis/cxx-uninitialized-object-unionlike-constructs.cpp
  test/Analysis/cxx-uninitialized-object.cpp
  test/Analysis/objcpp-uninitialized-object.mm
  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,6 +543,119 @@
 
 Name, DescriptionExample
 
+
+cplusplus.UninitializedObject
+(C++)
+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. 
+The checker regards inherited fields as direct fields, so one will recieve
+warnings for uninitialized inherited data members as well. 
+
+It has several options:
+
+  
+"Pedantic" (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 
+-analyzer-config cplusplus.UninitializedObject:Pedantic=true.
+  
+  
+"NotesAsWarnings" (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. 
+-analyzer-config cplusplus.UninitializedObject:NotesAsWarnings=true.
+  
+  
+"CheckPointeeInitialization" (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. 
+-analyzer-config cplusplus.UninitializedObject:CheckPointeeInitialization=true.
+  
+  
+"IgnoreRecordsWithField" (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 "".
+
+-analyzer-config cplusplus.UninitializedObject:IgnoreRecordsWithField="[Tt]ag|[Kk]ind".
+  
+
+
+
+// With Pedantic and CheckPointeeInitialization set to true
+
+struct A {
+  struct B {
+int x; // note: uninitialized field 'this->b.x'
+   // note: uninitialized field 'this->bptr->x'
+int y; // note: uninitialized field 'this->b.y'
+   // note: uninitialized field 'this->bptr->y'
+  };
+  int *iptr; // note: uninitialized pointer 'this->iptr'
+  B b;
+  B *bptr;
+  char *cptr; // note: uninitialized pointee 'this->cptr'
+
+  A (B *bptr, char *cptr) : bptr(bptr), cptr(cptr) {}
+};
+
+void f() {
+  A::B b;
+  char c;
+  A a(, ); // warning: 6 uninitialized fields
+   //  after the constructor call
+}
+
+
+// With Pedantic set to false and
+// CheckPointeeInitialization set to true
+// (every field is uninitialized)
+
+struct A {
+  struct B {
+int x;
+int y;
+  };
+  int *iptr;
+  B b;
+  B *bptr;
+  char *cptr;
+
+  A (B *bptr, char *cptr) : bptr(bptr), cptr(cptr) {}
+};
+
+void f() {
+  A::B b;
+  char c;
+  A a(, ); // no warning
+}
+
+
+// With Pedantic and CheckPointeeInitialization set to false
+// (pointees are regarded as initialized)
+
+struct A {
+  struct B {
+int x; // note: uninitialized field 'this->b.x'
+int y; // note: uninitialized field 'this->b.y'
+  };
+  int *iptr; // note: uninitialized pointer 'this->iptr'
+  B b;
+  B *bptr;
+  char *cptr;
+
+  A (B *bptr, char *cptr) : bptr(bptr), cptr(cptr) {}
+};
+
+void f() {
+  A::B b;
+  char c;
+  A a(, ); // warning: 3 uninitialized fields
+   //  after the constructor call
+}
+
+
 
 
 
Index: www/analyzer/alpha_checks.html
===
--- www/analyzer/alpha_checks.html
+++ www/analyzer/alpha_checks.html
@@ -445,120 +445,6 @@
 
 
 
-
-alpha.cplusplus.UninitializedObject
-(C++)
-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