[PATCH] D54563: [analyzer] MoveChecker Pt.4: Add a few more state reset methods.
Artem Dergachev via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Dec 3 16:43:23 PST 2018
NoQ added inline comments.
================
Comment at: test/Analysis/use-after-move.cpp:331
for (int i = 0; i < bignum(); i++) { // expected-note {{Loop condition is true. Entering loop body}} expected-note {{Loop condition is true. Entering loop body}}
constCopyOrMoveCall(std::move(a)); // expected-warning {{Moved-from object is moved 'a'}} expected-note {{Moved-from object is moved 'a'}}
// expected-note at -1 {{'a' is moved}}
----------------
Szelethus wrote:
> >Because `list2` is passed by non-const reference (eg., rvalue reference) into an unknown function, it will be invalidated when the call is modeled conservatively, and therefore we will stop tracking it in the `checkRegionChanges` callback.
>
> Hmmm. Doesn't this check something similar, but still cause an warning?
In this case `a` is passed by value. Therefore a move-constructor is called, and then the function does not have access to `a`.
================
Comment at: test/Analysis/use-after-move.cpp:260-262
for (int i = 0; i < bignum(); i++) { // expected-note {{Loop condition is false. Execution jumps to the end of the function}}
rightRefCall(std::move(a)); // no-warning
}
----------------
This would have been the test for our case, but in this test the function has a body and will not be evaluated conservatively.
================
Comment at: test/Analysis/use-after-move.cpp:597-615
void not_known(A &a);
void not_known(A *a);
void regionAndPointerEscapeTest() {
{
A a;
A b;
----------------
This would have been the test for our case, but the `&&` case isn't tested.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D54563/new/
https://reviews.llvm.org/D54563
More information about the cfe-commits
mailing list