Skip to content

Commit

Permalink
[clang-tidy][NFC] merge same part matchers in return-const-ref-from-p…
Browse files Browse the repository at this point in the history
…arameter (#118985)
  • Loading branch information
HerrCai0907 authored Dec 7, 2024
1 parent 8787bc7 commit 17a7f20
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down

0 comments on commit 17a7f20

Please sign in to comment.