[clang] [clang-tools-extra] [clang-tidy] New performance linter: performance-inefficient-copy-assign (PR #179467)
via cfe-commits
cfe-commits at lists.llvm.org
Tue Feb 3 06:12:10 PST 2026
github-actions[bot] wrote:
<!--LLVM CODE LINT COMMENT: clang-tidy-->
:warning: C/C++ code linter, clang-tidy found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
```bash
git diff -U0 origin/main...HEAD -- clang-tools-extra/clang-tidy/performance/InefficientCopyAssignCheck.cpp clang-tools-extra/clang-tidy/performance/InefficientCopyAssignCheck.h clang-tools-extra/clang-tidy/performance/PerformanceTidyModule.cpp |
python3 clang-tools-extra/clang-tidy/tool/clang-tidy-diff.py -path build -p1 -quiet
```
</details>
<details>
<summary>
View the output from clang-tidy here.
</summary>
```
clang-tools-extra/clang-tidy/performance/InefficientCopyAssignCheck.cpp:18:1: warning: included header SmallPtrSet.h is not used directly [misc-include-cleaner]
18 | #include "llvm/ADT/SmallPtrSet.h"
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
19 |
clang-tools-extra/clang-tidy/performance/InefficientCopyAssignCheck.cpp:20:1: warning: included header ExprSequence.h is not used directly [misc-include-cleaner]
20 | #include "../utils/ExprSequence.h"
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
21 | #include "../utils/Matchers.h"
clang-tools-extra/clang-tidy/performance/InefficientCopyAssignCheck.cpp:21:1: warning: included header Matchers.h is not used directly [misc-include-cleaner]
21 | #include "../utils/Matchers.h"
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
22 | #include <optional>
clang-tools-extra/clang-tidy/performance/InefficientCopyAssignCheck.cpp:22:1: warning: included header optional is not used directly [misc-include-cleaner]
22 | #include <optional>
| ^~~~~~~~~~~~~~~~~~~
23 |
clang-tools-extra/clang-tidy/performance/InefficientCopyAssignCheck.cpp:47:5: warning: variable 'Options' of type 'CFG::BuildOptions' can be declared 'const' [misc-const-correctness]
47 | CFG::BuildOptions Options;
| ^
| const
clang-tools-extra/clang-tidy/performance/InefficientCopyAssignCheck.cpp:67:3: warning: variable 'AssignValueQual' of type 'QualType' can be declared 'const' [misc-const-correctness]
67 | QualType AssignValueQual = AssignValueDecl->getType();
| ^
| const
clang-tools-extra/clang-tidy/performance/InefficientCopyAssignCheck.h:10:9: warning: header guard does not follow preferred style [llvm-header-guard]
10 | #ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_PERFORMANCE_INEFFICIENTCOPYASSIGN_H
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_PERFORMANCE_INEFFICIENTCOPYASSIGNCHECK_H
11 | #define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_PERFORMANCE_INEFFICIENTCOPYASSIGN_H
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_PERFORMANCE_INEFFICIENTCOPYASSIGNCHECK_H
```
</details>
https://github.com/llvm/llvm-project/pull/179467
More information about the cfe-commits
mailing list