diff options
| author | George Karpenkov <ekarpenkov@apple.com> | 2018-08-09 19:03:12 +0000 |
|---|---|---|
| committer | George Karpenkov <ekarpenkov@apple.com> | 2018-08-09 19:03:12 +0000 |
| commit | cf40ba82843faf215891e46de1a8eb092ea9d693 (patch) | |
| tree | 80cd894a5c6bebaed73201cc279f483d7462781c /clang/test/Analysis | |
| parent | 55accd7dd38c2e18ba16d63cad232f447b4c8d4c (diff) | |
| download | bcm5719-llvm-cf40ba82843faf215891e46de1a8eb092ea9d693.tar.gz bcm5719-llvm-cf40ba82843faf215891e46de1a8eb092ea9d693.zip | |
[analyzer] Fix the bug in UninitializedObjectChecker caused by not handling block pointers
Differential Revision: https://reviews.llvm.org/D50523
llvm-svn: 339369
Diffstat (limited to 'clang/test/Analysis')
| -rw-r--r-- | clang/test/Analysis/objcpp-uninitialized-object.mm | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/clang/test/Analysis/objcpp-uninitialized-object.mm b/clang/test/Analysis/objcpp-uninitialized-object.mm new file mode 100644 index 00000000000..7f2177e5791 --- /dev/null +++ b/clang/test/Analysis/objcpp-uninitialized-object.mm @@ -0,0 +1,22 @@ +// RUN: %clang_analyze_cc1 -analyzer-checker=core,alpha.cplusplus.UninitializedObject -std=c++11 -fblocks -verify %s + +typedef void (^myBlock) (); + +struct StructWithBlock { + int a; + myBlock z; // expected-note{{uninitialized field 'this->z'}} + + StructWithBlock() : a(0), z(^{}) {} + + // Miss initialization of field `z`. + StructWithBlock(int pA) : a(pA) {} // expected-warning{{1 uninitialized field at the end of the constructor call}} + +}; + +void warnOnUninitializedBlock() { + StructWithBlock a(10); +} + +void noWarningWhenInitialized() { + StructWithBlock a; +} |

