[PATCH] D67292: [clang-tidy] Fix bug in bugprone-use-after-move check

Yitzhak Mandelbaum via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Sep 6 12:10:34 PDT 2019


ymandel marked 2 inline comments as done.
ymandel added inline comments.


================
Comment at: clang-tools-extra/test/clang-tidy/bugprone-use-after-move.cpp:1198
+    }
+  }
   for (int i = 0; i < 10; ++i) {
----------------
gribozavr wrote:
> Unless you think it is redundant, could you also add
> 
> ```
> if (A a1; A(std::move(a2)).getInt() > 0) {}
> ```
> 
> Also some true positive tests would be good:
> 
> ```
> if (A a1; A(std::move(a2)).getInt() > A(std::move(a2)).getInt()) {}
> ```
> 
> ```
> A a1;
> if (A a2 = std::move(a1); A(std::move(a1)) > 0) {}
> ```
Done, but any idea why everything in this function is placed inside a loop?  Looks like its just for scoping, but then why not just a compound statement, as is done above? This feels very odd.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D67292





More information about the cfe-commits mailing list