Skip to content

Commit 7da6b1c

Browse files
committed
[clang-tidy][NFC] merge same part matchers in return-const-ref-from-parameter
1 parent d09632b commit 7da6b1c

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

clang-tools-extra/clang-tidy/bugprone/ReturnConstRefFromParameterCheck.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,12 @@ void ReturnConstRefFromParameterCheck::registerMatchers(MatchFinder *Finder) {
4141
qualType(hasCanonicalType(equalsBoundNode("type"))))))
4242
.bind("func");
4343

44-
Finder->addMatcher(returnStmt(hasReturnValue(DRef), hasAncestor(Func)), this);
4544
Finder->addMatcher(
46-
returnStmt(hasReturnValue(ignoringParens(conditionalOperator(
47-
eachOf(hasTrueExpression(DRef), hasFalseExpression(DRef)),
48-
hasAncestor(Func))))),
45+
returnStmt(
46+
hasReturnValue(anyOf(
47+
DRef, ignoringParens(conditionalOperator(eachOf(
48+
hasTrueExpression(DRef), hasFalseExpression(DRef)))))),
49+
hasAncestor(Func)),
4950
this);
5051
}
5152

0 commit comments

Comments
 (0)