[all-commits] [llvm/llvm-project] 415a82: [clang-tidy] `doesNotMutateObject`: Handle calls t...

Clement Courbet via All-commits all-commits at lists.llvm.org
Mon Jun 10 02:15:34 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 415a82c64afa0047383caf471aa872fdb0e2658d
      https://github.com/llvm/llvm-project/commit/415a82c64afa0047383caf471aa872fdb0e2658d
  Author: Clement Courbet <courbet at google.com>
  Date:   2024-06-10 (Mon, 10 Jun 2024)

  Changed paths:
    M clang-tools-extra/clang-tidy/performance/UnnecessaryCopyInitialization.cpp
    M clang-tools-extra/clang-tidy/utils/DeclRefExprUtils.cpp
    M clang-tools-extra/docs/ReleaseNotes.rst
    M clang-tools-extra/test/clang-tidy/checkers/performance/unnecessary-copy-initialization.cpp
    M clang-tools-extra/unittests/clang-tidy/DeclRefExprUtilsTest.cpp

  Log Message:
  -----------
  [clang-tidy] `doesNotMutateObject`: Handle calls to member functions … (#94362)

…and operators that have non-const overloads.

This allows  `unnecessary-copy-initialization` to warn on more cases.

The common case is a class with a a set of const/non-sconst overloads
(e.g. std::vector::operator[]).

```
void F() {
  std::vector<Expensive> v;
  // ...

  const Expensive e = v[i];
}
```



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