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/UseStdMoveCheck.cpp
clang-tools-extra/clang-tidy/performance/UseStdMoveCheck.h |
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/UseStdMoveCheck.cpp:161:9: warning:
variable 'Offset' of type 'unsigned int' can be declared 'const'
[misc-const-correctness]
161 | unsigned Offset = isa<CXXOperatorCallExpr>(Call) && Callee &&
| ^
| const
clang-tools-extra/clang-tidy/performance/UseStdMoveCheck.cpp:216:9: warning:
isa_and_nonnull<> is preferred over an explicit test for null followed by
calling isa<> [llvm-prefer-isa-or-dyn-cast-in-conditionals]
216 | Scope && isa<CompoundStmt, ForStmt, CXXForRangeStmt, IfStmt,
SwitchStmt,
|
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
217 | WhileStmt, CXXCatchStmt>(Scope))
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
clang-tools-extra/clang-tidy/performance/UseStdMoveCheck.cpp:243:5: warning:
variable 'Pointee' of type 'QualType' can be declared 'const'
[misc-const-correctness]
243 | QualType Pointee =
Method->getParamDecl(0)->getType()->getPointeeType();
| ^
| const
clang-tools-extra/clang-tidy/performance/UseStdMoveCheck.cpp:295:12: warning:
nested 'if' statements can be merged together [readability-redundant-nested-if]
295 | } else if (const auto *Binary = dyn_cast<BinaryOperator>(Parent)) {
| ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~
296 | if (Binary->getOpcode() != BO_Comma && Binary->getOpcode() !=
BO_LAnd &&
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
297 | Binary->getOpcode() != BO_LOr &&
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
298 | !(Binary->isAssignmentOp() &&
Context.getLangOpts().CPlusPlus17))
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
299 | if ((contains(Binary->getLHS(), Copy) &&
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
300 | contains(Binary->getRHS(), Reference)) ||
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
301 | (contains(Binary->getRHS(), Copy) &&
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
302 | contains(Binary->getLHS(), Reference)))
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
303 | return true;
304 | }
| ~
clang-tools-extra/clang-tidy/performance/UseStdMoveCheck.cpp:296:7: note:
nested 'if' statement to merge declared here
296 | if (Binary->getOpcode() != BO_Comma && Binary->getOpcode() !=
BO_LAnd &&
| ^
clang-tools-extra/clang-tidy/performance/UseStdMoveCheck.cpp:299:9: note:
nested 'if' statement to merge declared here
299 | if ((contains(Binary->getLHS(), Copy) &&
| ^
clang-tools-extra/clang-tidy/performance/UseStdMoveCheck.cpp:372:5: warning:
variable 'Found' of type 'const_iterator' (aka 'DenseMapIterator<const
clang::VarDecl *, llvm::SmallVector<const clang::DeclRefExpr *, 8>,
llvm::DenseMapInfo<const clang::VarDecl *, void>,
llvm::detail::DenseMapPair<const clang::VarDecl *, llvm::SmallVector<const
clang::DeclRefExpr *, 8>>, true>') can be declared 'const'
[misc-const-correctness]
372 | auto Found = References.find(Variable);
| ^
| const
clang-tools-extra/clang-tidy/performance/UseStdMoveCheck.cpp:593:8: warning:
static member accessed through instance
[readability-static-accessed-through-instance]
593 | !Result.Context->hasSameUnqualifiedType(
| ^~~~~~~~~~~~~~~~
| clang::ASTContext::
clang-tools-extra/clang-tidy/performance/UseStdMoveCheck.cpp:656:3: warning:
variable 'Diagnostic' of type 'DiagnosticBuilder' can be declared 'const'
[misc-const-correctness]
656 | DiagnosticBuilder Diagnostic = diag(Location, "'%0' could be moved
here")
| ^
| const
```
</details>
https://github.com/llvm/llvm-project/pull/228767
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits