[clang-tools-extra] [clang-tidy] fix false positive in bugprone-return-const-ref-from-parameter (PR #117734)
Piotr Zegar via cfe-commits
cfe-commits at lists.llvm.org
Tue Nov 26 09:14:31 PST 2024
================
@@ -18,14 +18,17 @@ namespace clang::tidy::bugprone {
void ReturnConstRefFromParameterCheck::registerMatchers(MatchFinder *Finder) {
const auto DRef = ignoringParens(
declRefExpr(
- to(parmVarDecl(hasType(hasCanonicalType(
- qualType(lValueReferenceType(pointee(
- qualType(isConstQualified()))))
- .bind("type"))))
+ to(parmVarDecl(
+ hasType(hasCanonicalType(
+ qualType(lValueReferenceType(
+ pointee(qualType(isConstQualified()))))
+ .bind("type"))),
+ parmVarDecl(hasDeclContext(functionDecl().bind("owner"))))
----------------
PiotrZSL wrote:
no need for duplicating parmVarDecl
https://github.com/llvm/llvm-project/pull/117734
More information about the cfe-commits
mailing list