]> granicus.if.org Git - clang/commit
Stop back-patching 'readonly' Objective-C properties with 'readwrite' ones.
authorDouglas Gregor <dgregor@apple.com>
Tue, 3 Nov 2015 01:15:46 +0000 (01:15 +0000)
committerDouglas Gregor <dgregor@apple.com>
Tue, 3 Nov 2015 01:15:46 +0000 (01:15 +0000)
commit249d7a566d3169e9f75918c3a0170cf90662224f
tree5a32b44955ab9aa8b816c990a4729a5988a731b8
parent97e5436f69f1bfa7f3e7fd2ecd80cdee0ae95bef
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@251874 91177308-0d34-0410-b5e6-96231b3b80d8
21 files changed:
include/clang/AST/ASTMutationListener.h
include/clang/AST/DeclObjC.h
include/clang/Basic/DiagnosticSemaKinds.td
include/clang/Sema/Sema.h
include/clang/Serialization/ASTWriter.h
lib/ARCMigrate/TransProperties.cpp
lib/AST/DeclObjC.cpp
lib/CodeGen/CGDebugInfo.cpp
lib/Frontend/MultiplexConsumer.cpp
lib/Sema/SemaDeclObjC.cpp
lib/Sema/SemaExprObjC.cpp
lib/Sema/SemaObjCProperty.cpp
lib/Serialization/ASTWriter.cpp
test/FixIt/atomic-property.m
test/Index/complete-kvc.m
test/Modules/ModuleDebugInfo.m
test/PCH/chain-categories.m
test/SemaObjC/atomoic-property-synnthesis-rules.m
test/SemaObjC/property-3.m
test/SemaObjC/property-in-class-extension-1.m
test/SemaObjCXX/property-invalid-type.mm