[clang] 442a802 - [clang] Don't make synthesized accessor stub functions visible twice

Raphael Isemann via cfe-commits cfe-commits at lists.llvm.org
Tue Aug 11 07:24:12 PDT 2020


Author: Raphael Isemann
Date: 2020-08-11T16:23:51+02:00
New Revision: 442a80292d50d895396eb14418bd471e7da68fd0

URL: https://github.com/llvm/llvm-project/commit/442a80292d50d895396eb14418bd471e7da68fd0
DIFF: https://github.com/llvm/llvm-project/commit/442a80292d50d895396eb14418bd471e7da68fd0.diff

LOG: [clang] Don't make synthesized accessor stub functions visible twice

`addDecl` is making the Decl visible, so there is no need to make it explicitly
visible again. Making it visible twice will also make the lookup storage less
efficient and potentially lead to crashes, see D84827 for that.

Reviewed By: aprantl

Differential Revision: https://reviews.llvm.org/D84828

Added: 
    

Modified: 
    clang/lib/Sema/SemaDeclObjC.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/Sema/SemaDeclObjC.cpp b/clang/lib/Sema/SemaDeclObjC.cpp
index d376880a40e8..89815b838500 100644
--- a/clang/lib/Sema/SemaDeclObjC.cpp
+++ b/clang/lib/Sema/SemaDeclObjC.cpp
@@ -3922,15 +3922,11 @@ Decl *Sema::ActOnAtEnd(Scope *S, SourceRange AtEnd, ArrayRef<Decl *> allMethods,
   if (auto *OID = dyn_cast<ObjCImplementationDecl>(CurContext)) {
     for (auto PropImpl : OID->property_impls()) {
       if (auto *Getter = PropImpl->getGetterMethodDecl())
-        if (Getter->isSynthesizedAccessorStub()) {
-          OID->makeDeclVisibleInContext(Getter);
+        if (Getter->isSynthesizedAccessorStub())
           OID->addDecl(Getter);
-        }
       if (auto *Setter = PropImpl->getSetterMethodDecl())
-        if (Setter->isSynthesizedAccessorStub()) {
-          OID->makeDeclVisibleInContext(Setter);
+        if (Setter->isSynthesizedAccessorStub())
           OID->addDecl(Setter);
-        }
     }
   }
 


        


More information about the cfe-commits mailing list