[PATCH] D73441: [clang-tidy] Fix bugprone-use-after-move when move is in noexcept operator

Dmitri Gribenko via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jan 27 04:14:36 PST 2020


gribozavr2 accepted this revision.
gribozavr2 added a comment.
This revision is now accepted and ready to land.

LGTM with fixes to the test.



================
Comment at: clang-tools-extra/test/clang-tidy/checkers/bugprone-use-after-move.cpp:1276
+namespace PR44667 {
+#define REQUIRE(expr) (void)(expr);
+struct S {};
----------------
njames93 wrote:
> gribozavr2 wrote:
> > njames93 wrote:
> > > gribozavr2 wrote:
> > > > Is the macro a necessary part of this test? If not, can it be removed?
> > > I like to stick to the bug report as much as possible
> > This is not generally the policy in LLVM and Clang. We prefer minimal reproducers.
> I've kept it minimal, the REQUIRE definition is just to suppress other warnings about unused expressions
Adding `(void)` should do the trick.


================
Comment at: clang-tools-extra/test/clang-tidy/checkers/bugprone-use-after-move.cpp:1279
+
+void foo() {
+  S s;
----------------
I'm not sure why `foo` and `otherUnenvaluated` are separate functions. If you want to separate them, I think it would make more sense to put each operator into a separate function then.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D73441





More information about the cfe-commits mailing list