[all-commits] [llvm/llvm-project] e67d91: [clang-tidy] Use-after-move: Ignore moves inside a...

martinboehme via All-commits all-commits at lists.llvm.org
Fri Mar 5 06:06:24 PST 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: e67d91faec2183789b220c15444929fb2efa6ecd
      https://github.com/llvm/llvm-project/commit/e67d91faec2183789b220c15444929fb2efa6ecd
  Author: Martin Boehme <mboehme at google.com>
  Date:   2021-03-05 (Fri, 05 Mar 2021)

  Changed paths:
    M clang-tools-extra/clang-tidy/bugprone/UseAfterMoveCheck.cpp
    M clang-tools-extra/docs/clang-tidy/checks/bugprone-use-after-move.rst
    M clang-tools-extra/test/clang-tidy/checkers/bugprone-use-after-move.cpp

  Log Message:
  -----------
  [clang-tidy] Use-after-move: Ignore moves inside a try_emplace.

We have no way to reason about the bool returned by try_emplace, so we
simply ignore any std::move()s that happen in a try_emplace argument.
A lot of the time in this situation, the code will be checking the
bool and doing something else if it turns out the value wasn't moved
into the map, and this has been causing false positives so far.

I don't currently have any intentions of handling "maybe move" functions
more generally.

Reviewed By: sammccall

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




More information about the All-commits mailing list