[clang-tools-extra] 17a7f20 - [clang-tidy][NFC] merge same part matchers in return-const-ref-from-parameter (#118985)
via cfe-commits
cfe-commits at lists.llvm.org
Fri Dec 6 16:00:14 PST 2024
Author: Congcong Cai
Date: 2024-12-07T08:00:11+08:00
New Revision: 17a7f20685de2a275fc2e53a38c5818797fe8a44
URL: https://github.com/llvm/llvm-project/commit/17a7f20685de2a275fc2e53a38c5818797fe8a44
DIFF: https://github.com/llvm/llvm-project/commit/17a7f20685de2a275fc2e53a38c5818797fe8a44.diff
LOG: [clang-tidy][NFC] merge same part matchers in return-const-ref-from-parameter (#118985)
Added:
Modified:
clang-tools-extra/clang-tidy/bugprone/ReturnConstRefFromParameterCheck.cpp
Removed:
################################################################################
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);
}
More information about the cfe-commits
mailing list