Skip to content

Commit 1c3d627

Browse files
committed
the conditional operator has to be the returned value
1 parent b00b02b commit 1c3d627

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
@@ -30,10 +30,11 @@ void ReturnConstRefFromParameterCheck::registerMatchers(MatchFinder *Finder) {
3030
.bind("func");
3131

3232
Finder->addMatcher(returnStmt(hasReturnValue(DRef), hasAncestor(Func)), this);
33-
Finder->addMatcher(conditionalOperator(eachOf(hasTrueExpression(DRef),
34-
hasFalseExpression(DRef)),
35-
hasAncestor(Func)),
36-
this);
33+
Finder->addMatcher(
34+
returnStmt(hasReturnValue(ignoringParens(conditionalOperator(
35+
eachOf(hasTrueExpression(DRef), hasFalseExpression(DRef)),
36+
hasAncestor(Func))))),
37+
this);
3738
}
3839

3940
static bool isSameTypeIgnoringConst(QualType A, QualType B) {

0 commit comments

Comments
 (0)