[all-commits] [llvm/llvm-project] 77ec20: [clang-tidy] let UseAfterMoveFinder::find() return...

Kefu Chai via All-commits all-commits at lists.llvm.org
Wed Jul 10 09:20:04 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 77ec20c2fcfe1578bd62258cc5e185236d2abf81
      https://github.com/llvm/llvm-project/commit/77ec20c2fcfe1578bd62258cc5e185236d2abf81
  Author: Kefu Chai <kefu.chai at scylladb.com>
  Date:   2024-07-10 (Wed, 10 Jul 2024)

  Changed paths:
    M clang-tools-extra/clang-tidy/bugprone/UseAfterMoveCheck.cpp

  Log Message:
  -----------
  [clang-tidy] let UseAfterMoveFinder::find() return an optional<UseAfterMove> (#98100)

before this change, we use an output parameter so
`UseAfterMoveFinder::find()` can return the found `UseAfterMove`, and
addition to it, `UseAfterMoveFinder::find()` return a bool, so we can
tell if a use-after-free is identified. this arrangement could be
confusing when one needs to understand when the each member variable of
the returned `UseAfterMove` instance is initialized.

in this change, we return an `std::optional<UseAfterMove>` instead of a
bool, so that it's more obvious on when/where the returned
`UseAfterMove` is initialized.

this change is a cleanup. so it does not change the behavior of this
check.

Signed-off-by: Kefu Chai <kefu.chai at scylladb.com>



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list