From acf4fd30398b9c9efb51c01f2b0b0ec5865e3ecb Mon Sep 17 00:00:00 2001 From: Douglas Gregor Date: Tue, 3 Nov 2015 01:15:46 +0000 Subject: Stop back-patching 'readonly' Objective-C properties with 'readwrite' ones. A 'readonly' Objective-C property declared in the primary class can effectively be shadowed by a 'readwrite' property declared within an extension of that class, so long as the types and attributes of the two property declarations are compatible. Previously, this functionality was implemented by back-patching the original 'readonly' property to make it 'readwrite', destroying source information and causing some hideously redundant, incorrect code. Simplify the implementation to express how this should actually be modeled: as a separate property declaration in the extension that shadows (via the name lookup rules) the declaration in the primary class. While here, correct some broken Fix-Its, eliminate a pile of redundant code, clean up the ARC migrator's handling of properties declared in extensions, and fix debug info's naming of methods that come from categories. A wonderous side effect of doing this write is that it eliminates the "AddedObjCPropertyInClassExtension" method from the AST mutation listener, which in turn eliminates the last place where we rewrite entire declarations in a chained PCH file or a module file. This change (which fixes rdar://problem/18475765) will allow us to eliminate the rewritten-decls logic from the serialization library, and fixes a crash (rdar://problem/23247794) illustrated by the test/PCH/chain-categories.m example. llvm-svn: 251874 --- clang/lib/Frontend/MultiplexConsumer.cpp | 10 ---------- 1 file changed, 10 deletions(-) (limited to 'clang/lib/Frontend') diff --git a/clang/lib/Frontend/MultiplexConsumer.cpp b/clang/lib/Frontend/MultiplexConsumer.cpp index 91ee100f639..12c85240bd7 100644 --- a/clang/lib/Frontend/MultiplexConsumer.cpp +++ b/clang/lib/Frontend/MultiplexConsumer.cpp @@ -122,9 +122,6 @@ public: void AddedObjCCategoryToInterface(const ObjCCategoryDecl *CatD, const ObjCInterfaceDecl *IFD) override; void FunctionDefinitionInstantiated(const FunctionDecl *D) override; - void AddedObjCPropertyInClassExtension(const ObjCPropertyDecl *Prop, - const ObjCPropertyDecl *OrigProp, - const ObjCCategoryDecl *ClassExt) override; void DeclarationMarkedUsed(const Decl *D) override; void DeclarationMarkedOpenMPThreadPrivate(const Decl *D) override; void RedefinedHiddenDefinition(const NamedDecl *D, Module *M) override; @@ -207,13 +204,6 @@ void MultiplexASTMutationListener::FunctionDefinitionInstantiated( for (auto &Listener : Listeners) Listener->FunctionDefinitionInstantiated(D); } -void MultiplexASTMutationListener::AddedObjCPropertyInClassExtension( - const ObjCPropertyDecl *Prop, - const ObjCPropertyDecl *OrigProp, - const ObjCCategoryDecl *ClassExt) { - for (size_t i = 0, e = Listeners.size(); i != e; ++i) - Listeners[i]->AddedObjCPropertyInClassExtension(Prop, OrigProp, ClassExt); -} void MultiplexASTMutationListener::DeclarationMarkedUsed(const Decl *D) { for (size_t i = 0, e = Listeners.size(); i != e; ++i) Listeners[i]->DeclarationMarkedUsed(D); -- cgit v1.2.3