diff options
author | Kristof Umann <dkszelethus@gmail.com> | 2018-08-13 18:43:08 +0000 |
---|---|---|
committer | Kristof Umann <dkszelethus@gmail.com> | 2018-08-13 18:43:08 +0000 |
commit | 532d7042492df38e565c108a7e2948df5445dbcf (patch) | |
tree | be5c754e5c992ee71faf0676d02fee8c1a33994c /test/Analysis/cxx-uninitialized-object.cpp | |
parent | e0f3e3d9917bed4a6525ac066afba25fce0ccfa4 (diff) |
[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
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@339599 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Analysis/cxx-uninitialized-object.cpp')
-rw-r--r-- | test/Analysis/cxx-uninitialized-object.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/test/Analysis/cxx-uninitialized-object.cpp b/test/Analysis/cxx-uninitialized-object.cpp index 4fc455fea8..e9079d99af 100644 --- a/test/Analysis/cxx-uninitialized-object.cpp +++ b/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()); } |