[all-commits] [llvm/llvm-project] ba4411: [clang-tidy] performance-unnecessary-copy-initiali...

Clement Courbet via All-commits all-commits at lists.llvm.org
Tue Nov 23 23:14:16 PST 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: ba4411e7c6a5879ce8acf246b0cd03ec738d9d6b
      https://github.com/llvm/llvm-project/commit/ba4411e7c6a5879ce8acf246b0cd03ec738d9d6b
  Author: Clement Courbet <courbet at google.com>
  Date:   2021-11-24 (Wed, 24 Nov 2021)

  Changed paths:
    M clang-tools-extra/clang-tidy/performance/UnnecessaryCopyInitialization.cpp
    M clang-tools-extra/test/clang-tidy/checkers/performance-unnecessary-copy-initialization-excluded-container-types.cpp
    M clang-tools-extra/test/clang-tidy/checkers/performance-unnecessary-copy-initialization.cpp

  Log Message:
  -----------
  [clang-tidy] performance-unnecessary-copy-initialization: Fix false negative.

`isConstRefReturningMethodCall` should be considering
`CXXOperatorCallExpr` in addition to `CXXMemberCallExpr`. Clang considers
these to be distinct (`CXXOperatorCallExpr` derives from `CallExpr`, not
`CXXMemberCallExpr`), but we don't care in the context of this
check.

This is important because of
`std::vector<Expensive>::operator[](size_t) const`.

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




More information about the All-commits mailing list