[clang] [Clang] eliminate shadowing warnings for parameters using deducing this (PR #114813)
Oleksandr T. via cfe-commits
cfe-commits at lists.llvm.org
Wed Nov 20 04:33:31 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;
----------------
a-tarasyuk wrote:
@Sirraide it does exist., however, it doesn't handle the case described above
https://github.com/llvm/llvm-project/blob/08e7609692af3cb84da510deac70eeb02cbceb6d/clang/include/clang/AST/ASTLambda.h#L38-L41
https://github.com/llvm/llvm-project/pull/114813
More information about the cfe-commits
mailing list