[clang-tools-extra] [clang-tidy] Add readability-constant-operand-order check (PR #167158)
via cfe-commits
cfe-commits at lists.llvm.org
Sat Nov 8 09:11:08 PST 2025
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/readability/ConstantOperandOrderCheck.cpp clang-tools-extra/clang-tidy/readability/ConstantOperandOrderCheck.h clang-tools-extra/clang-tidy/readability/ReadabilityTidyModule.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/readability/ConstantOperandOrderCheck.cpp:56:20: warning: place static function 'strip' outside of an anonymous namespace [llvm-prefer-static-over-anonymous-namespace]
56 | static const Expr *strip(const Expr *E) {
| ^
clang-tools-extra/clang-tidy/readability/ConstantOperandOrderCheck.cpp:60:13: warning: place static function 'isSimpleConstantExpr' outside of an anonymous namespace [llvm-prefer-static-over-anonymous-namespace]
60 | static bool isSimpleConstantExpr(const Expr *E) {
| ^
clang-tools-extra/clang-tidy/readability/ConstantOperandOrderCheck.cpp:81:13: warning: unused function 'hasSideEffectsExpr' [clang-diagnostic-unused-function]
81 | static bool hasSideEffectsExpr(const Expr *E, ASTContext &Ctx) {
| ^~~~~~~~~~~~~~~~~~
clang-tools-extra/clang-tidy/readability/ConstantOperandOrderCheck.cpp:81:13: warning: place static function 'hasSideEffectsExpr' outside of an anonymous namespace [llvm-prefer-static-over-anonymous-namespace]
clang-tools-extra/clang-tidy/readability/ConstantOperandOrderCheck.cpp:86:20: warning: place static function 'invertOperatorText' outside of an anonymous namespace [llvm-prefer-static-over-anonymous-namespace]
86 | static std::string invertOperatorText(llvm::StringRef Op) {
| ^
```
</details>
https://github.com/llvm/llvm-project/pull/167158
More information about the cfe-commits
mailing list