mwyman created this revision.
mwyman added a project: clang.
Herald added a project: All.
mwyman requested review of this revision.
Herald added a subscriber: cfe-commits.

When compiling Objective-C++, name lookup uses the C++ lookup behavior that 
skips the filtering of non-implicit-self references, and will use a shadowed 
name that matches the type. As a result implicit ivar access behavior differs 
between Objective-C and Objective-C++, which can impact local access but also 
block captures.

This addresses the issue #56193 
<https://github.com/llvm/llvm-project/issues/56193> as reported on Github.

Unfortunately it appears the behavior has differed for 11 years (since the 
original fix for ObjC was applied in 2011).


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D128556

Files:
  clang/lib/Sema/SemaLookup.cpp


Index: clang/lib/Sema/SemaLookup.cpp
===================================================================
--- clang/lib/Sema/SemaLookup.cpp
+++ clang/lib/Sema/SemaLookup.cpp
@@ -1313,6 +1313,9 @@
             R.setShadowed();
             continue;
           }
+        } else if (NameKind == LookupObjCImplicitSelfParam &&
+                   !isa<ImplicitParamDecl>(*I)) {
+          continue;
         } else {
           // We found something in this scope, we should not look at the
           // namespace scope


Index: clang/lib/Sema/SemaLookup.cpp
===================================================================
--- clang/lib/Sema/SemaLookup.cpp
+++ clang/lib/Sema/SemaLookup.cpp
@@ -1313,6 +1313,9 @@
             R.setShadowed();
             continue;
           }
+        } else if (NameKind == LookupObjCImplicitSelfParam &&
+                   !isa<ImplicitParamDecl>(*I)) {
+          continue;
         } else {
           // We found something in this scope, we should not look at the
           // namespace scope
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to