[clang-tools-extra] [clang-tidy][NFC] merge same part matchers in return-const-ref-from-parameter (PR #118985)
via cfe-commits
cfe-commits at lists.llvm.org
Fri Dec 6 07:16:39 PST 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-clang-tidy
Author: Congcong Cai (HerrCai0907)
<details>
<summary>Changes</summary>
---
Full diff: https://github.com/llvm/llvm-project/pull/118985.diff
1 Files Affected:
- (modified) clang-tools-extra/clang-tidy/bugprone/ReturnConstRefFromParameterCheck.cpp (+5-4)
``````````diff
diff --git a/clang-tools-extra/clang-tidy/bugprone/ReturnConstRefFromParameterCheck.cpp b/clang-tools-extra/clang-tidy/bugprone/ReturnConstRefFromParameterCheck.cpp
index 1bd7abbad66d27..a35fcd99d494af 100644
--- a/clang-tools-extra/clang-tidy/bugprone/ReturnConstRefFromParameterCheck.cpp
+++ b/clang-tools-extra/clang-tidy/bugprone/ReturnConstRefFromParameterCheck.cpp
@@ -41,11 +41,12 @@ void ReturnConstRefFromParameterCheck::registerMatchers(MatchFinder *Finder) {
qualType(hasCanonicalType(equalsBoundNode("type"))))))
.bind("func");
- Finder->addMatcher(returnStmt(hasReturnValue(DRef), hasAncestor(Func)), this);
Finder->addMatcher(
- returnStmt(hasReturnValue(ignoringParens(conditionalOperator(
- eachOf(hasTrueExpression(DRef), hasFalseExpression(DRef)),
- hasAncestor(Func))))),
+ returnStmt(
+ hasReturnValue(anyOf(
+ DRef, ignoringParens(conditionalOperator(eachOf(
+ hasTrueExpression(DRef), hasFalseExpression(DRef)))))),
+ hasAncestor(Func)),
this);
}
``````````
</details>
https://github.com/llvm/llvm-project/pull/118985
More information about the cfe-commits
mailing list