[clang-tidy] Fix bug in bugprone-use-after-move check
authorYitzhak Mandelbaum <yitzhakm@google.com>
Mon, 9 Sep 2019 12:59:14 +0000 (12:59 +0000)
committerYitzhak Mandelbaum <yitzhakm@google.com>
Mon, 9 Sep 2019 12:59:14 +0000 (12:59 +0000)
commitf9ce864558ab4110233e86f6391ced320dd1e07b
tree155f36c4a8e7adaf6d37c9597471f9c2e1ce752d
parent1ad508e8e2d5036a6356a136ab0b02251091e2a6
[clang-tidy] Fix bug in bugprone-use-after-move check

Summary:
The bugprone-use-after-move check exhibits false positives for certain uses of
the C++17 if/switch init statements. These false positives are caused by a bug
in the ExprSequence calculations.

This revision adds tests for the false positives and fixes the corresponding
sequence calculation.

Reviewers: gribozavr

Subscribers: xazax.hun, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D67292

llvm-svn: 371396
clang-tools-extra/clang-tidy/utils/ExprSequence.cpp
clang-tools-extra/test/clang-tidy/bugprone-use-after-move.cpp