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); }