[clang] [Clang] eliminate shadowing warnings for parameters using deducing this (PR #114813)
via cfe-commits
cfe-commits at lists.llvm.org
Wed Nov 6 03:02:07 PST 2024
================
@@ -8236,11 +8236,14 @@ void Sema::CheckShadow(NamedDecl *D, NamedDecl *ShadowedDecl,
DeclContext *NewDC = D->getDeclContext();
if (FieldDecl *FD = dyn_cast<FieldDecl>(ShadowedDecl)) {
- // Fields are not shadowed by variables in C++ static methods.
- if (CXXMethodDecl *MD = dyn_cast<CXXMethodDecl>(NewDC))
+ if (CXXMethodDecl *MD = dyn_cast<CXXMethodDecl>(NewDC)) {
+ // Fields are not shadowed by variables in C++ static methods.
if (MD->isStatic())
return;
+ if (!MD->getParent()->isLambda() && MD->isExplicitObjectMemberFunction())
+ return;
----------------
Sirraide wrote:
We might want a similar function that does more or less the opposite in that case (i.e. an `isLambdaCallWithExplicitObjectParameter`)?
CC @cor3ntin
https://github.com/llvm/llvm-project/pull/114813
More information about the cfe-commits
mailing list