summaryrefslogtreecommitdiffstats
path: root/clang/test/Analysis
diff options
context:
space:
mode:
authorKristof Umann <dkszelethus@gmail.com>2018-08-13 18:43:08 +0000
committerKristof Umann <dkszelethus@gmail.com>2018-08-13 18:43:08 +0000
commit015b059569eef883e9313035cd98c72f947477ab (patch)
tree850c472d40251407a22ed90feca61c38c213227d /clang/test/Analysis
parente33062369e67ab95949ab8f5f52dbc1027332199 (diff)
downloadbcm5719-llvm-015b059569eef883e9313035cd98c72f947477ab.tar.gz
bcm5719-llvm-015b059569eef883e9313035cd98c72f947477ab.zip
[analyzer][UninitializedObjectChecker] Refactoring p4.: Wrap FieldRegions and reduce weight on FieldChainInfo
Before this patch, FieldChainInfo used a spaghetti: it took care of way too many cases, even though it was always meant as a lightweight wrapper around ImmutableList<const FieldRegion *>. This problem is solved by introducing a lightweight polymorphic wrapper around const FieldRegion *, FieldNode. It is an interface that abstracts away special cases like pointers/references, objects that need to be casted to another type for a proper note messages. Changes to FieldChainInfo: * Now wraps ImmutableList<const FieldNode &>. * Any pointer/reference related fields and methods were removed * Got a new add method. This replaces it's former constructors as a way to create a new FieldChainInfo objects with a new element. Changes to FindUninitializedField: * In order not to deal with dynamic memory management, when an uninitialized field is found, the note message for it is constructed and is stored instead of a FieldChainInfo object. (see doc around addFieldToUninits). Some of the test files are changed too, from now on uninitialized pointees of references always print "uninitialized pointee" instead of "uninitialized field" (which should've really been like this from the beginning). I also updated every comment according to these changes. Differential Revision: https://reviews.llvm.org/D50506 llvm-svn: 339599
Diffstat (limited to 'clang/test/Analysis')
-rw-r--r--clang/test/Analysis/cxx-uninitialized-object.cpp8
-rw-r--r--clang/test/Analysis/objcpp-uninitialized-object.mm2
2 files changed, 5 insertions, 5 deletions
diff --git a/clang/test/Analysis/cxx-uninitialized-object.cpp b/clang/test/Analysis/cxx-uninitialized-object.cpp
index 4fc455fea8a..e9079d99af3 100644
--- a/clang/test/Analysis/cxx-uninitialized-object.cpp
+++ b/clang/test/Analysis/cxx-uninitialized-object.cpp
@@ -781,7 +781,7 @@ struct LambdaTest2 {
void fLambdaTest2() {
int b;
- auto equals = [&b](int a) { return a == b; }; // expected-note{{uninitialized field 'this->functor.b'}}
+ auto equals = [&b](int a) { return a == b; }; // expected-note{{uninitialized pointee 'this->functor.b'}}
LambdaTest2<decltype(equals)>(equals, int());
}
#else
@@ -857,8 +857,8 @@ struct MultipleLambdaCapturesTest1 {
void fMultipleLambdaCapturesTest1() {
int b1, b2 = 3, b3;
- auto equals = [&b1, &b2, &b3](int a) { return a == b1 == b2 == b3; }; // expected-note{{uninitialized field 'this->functor.b1'}}
- // expected-note@-1{{uninitialized field 'this->functor.b3'}}
+ auto equals = [&b1, &b2, &b3](int a) { return a == b1 == b2 == b3; }; // expected-note{{uninitialized pointee 'this->functor.b1'}}
+ // expected-note@-1{{uninitialized pointee 'this->functor.b3'}}
MultipleLambdaCapturesTest1<decltype(equals)>(equals, int());
}
@@ -872,7 +872,7 @@ struct MultipleLambdaCapturesTest2 {
void fMultipleLambdaCapturesTest2() {
int b1, b2 = 3, b3;
- auto equals = [b1, &b2, &b3](int a) { return a == b1 == b2 == b3; }; // expected-note{{uninitialized field 'this->functor.b3'}}
+ auto equals = [b1, &b2, &b3](int a) { return a == b1 == b2 == b3; }; // expected-note{{uninitialized pointee 'this->functor.b3'}}
MultipleLambdaCapturesTest2<decltype(equals)>(equals, int());
}
diff --git a/clang/test/Analysis/objcpp-uninitialized-object.mm b/clang/test/Analysis/objcpp-uninitialized-object.mm
index 7f2177e5791..3ec1eb75182 100644
--- a/clang/test/Analysis/objcpp-uninitialized-object.mm
+++ b/clang/test/Analysis/objcpp-uninitialized-object.mm
@@ -4,7 +4,7 @@ typedef void (^myBlock) ();
struct StructWithBlock {
int a;
- myBlock z; // expected-note{{uninitialized field 'this->z'}}
+ myBlock z; // expected-note{{uninitialized pointer 'this->z'}}
StructWithBlock() : a(0), z(^{}) {}
OpenPOWER on IntegriCloud