[Openmp-commits] [llvm] [flang] [libcxxabi] [libc] [compiler-rt] [openmp] [mlir] [clang] [libcxx] [clang-tools-extra] [clang] Avoid -Wshadow warning when init-capture named same as class field (PR #74512)
Shafik Yaghmour via Openmp-commits
openmp-commits at lists.llvm.org
Thu Jan 25 14:09:04 PST 2024
================
@@ -8395,10 +8395,11 @@ void Sema::CheckShadow(NamedDecl *D, NamedDecl *ShadowedDecl,
unsigned WarningDiag = diag::warn_decl_shadow;
SourceLocation CaptureLoc;
- if (isa<VarDecl>(D) && isa<VarDecl>(ShadowedDecl) && NewDC &&
- isa<CXXMethodDecl>(NewDC)) {
+ if (isa<VarDecl>(D) && NewDC && isa<CXXMethodDecl>(NewDC)) {
if (const auto *RD = dyn_cast<CXXRecordDecl>(NewDC->getParent())) {
if (RD->isLambda() && OldDC->Encloses(NewDC->getLexicalParent())) {
+ if (!isa<VarDecl>(ShadowedDecl))
----------------
shafik wrote:
Yeah, just a comment to explain why `ShadownDecl` not being a `VarDecl` matters here.
https://github.com/llvm/llvm-project/pull/74512
More information about the Openmp-commits
mailing list