summaryrefslogtreecommitdiff
path: root/lib/Sema/SemaObjCProperty.cpp
Commit message (Collapse)AuthorAgeFilesLines
* [NFCI]Create CommonAttributeInfo Type as base type of *Attr and ParsedAttr.Erich Keane2019-09-131-6/+6
| | | | | | | | | | | | In order to enable future improvements to our attribute diagnostics, this moves info from ParsedAttr into CommonAttributeInfo, then makes this type the base of the *Attr and ParsedAttr types. Quite a bit of refactoring took place, including removing a bunch of redundant Spelling Index propogation. Differential Revision: https://reviews.llvm.org/D67368 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@371875 91177308-0d34-0410-b5e6-96231b3b80d8
* clang: Fix typo in commentNico Weber2019-08-211-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@369542 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix parameter name comments using clang-tidy. NFC.Rui Ueyama2019-07-161-1/+1
| | | | | | | | | | | | | | | | | | | | | This patch applies clang-tidy's bugprone-argument-comment tool to LLVM, clang and lld source trees. Here is how I created this patch: $ git clone https://github.com/llvm/llvm-project.git $ cd llvm-project $ mkdir build $ cd build $ cmake -GNinja -DCMAKE_BUILD_TYPE=Debug \ -DLLVM_ENABLE_PROJECTS='clang;lld;clang-tools-extra' \ -DCMAKE_EXPORT_COMPILE_COMMANDS=On -DLLVM_ENABLE_LLD=On \ -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ ../llvm $ ninja $ parallel clang-tidy -checks='-*,bugprone-argument-comment' \ -config='{CheckOptions: [{key: StrictMode, value: 1}]}' -fix \ ::: ../llvm/lib/**/*.{cpp,h} ../clang/lib/**/*.{cpp,h} ../lld/**/*.{cpp,h} git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@366177 91177308-0d34-0410-b5e6-96231b3b80d8
* Range-style std::find{,_if} -> llvm::find{,_if}. NFCFangrui Song2019-03-311-5/+4
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@357359 91177308-0d34-0410-b5e6-96231b3b80d8
* [Sema][ObjC] Allow silencing -Wobjc-designated-initializers warnings byAkira Hatanaka2019-03-011-0/+9
| | | | | | | | | | | | | declaring an unavailable method in the subclass's extension that overrides the designated initializer in the base class. r243676 made changes to allow declaring the unavailable method in the subclass interface to silence the warning. This commit additionally allows declaring the unavailable method in the class extension. rdar://problem/42731306 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@355175 91177308-0d34-0410-b5e6-96231b3b80d8
* Update the file headers across all of the LLVM projects in the monorepoChandler Carruth2019-01-191-4/+3
| | | | | | | | | | | | | | | | | to reflect the new license. We understand that people may be surprised that we're moving the header entirely to discuss the new license. We checked this carefully with the Foundation's lawyer and we believe this is the correct approach. Essentially, all code in the project is now made available by the LLVM project under our new license, so you will see that the license headers include that license only. Some of our contributors have contributed code under our old license, and accordingly, we have retained a copy of our old license notice in the top-level files in each project and repository. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@351636 91177308-0d34-0410-b5e6-96231b3b80d8
* [AST][NFC] Pass the AST context to one of the ctor of DeclRefExpr.Bruno Ricci2018-12-211-8/+8
| | | | | | | | | | | All of the other constructors already take a reference to the AST context. This avoids calling Decl::getASTContext in most cases. Additionally move the definition of the constructor from Expr.h to Expr.cpp since it is calling DeclRefExpr::computeDependence. NFC. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@349901 91177308-0d34-0410-b5e6-96231b3b80d8
* Add -Wobjc-property-assign-on-object-type.John McCall2018-09-051-0/+8
| | | | | | | | | | | | This is a warning about using 'assign' instead of 'unsafe_unretained' in Objective-C property declarations. It's off by default because there isn't consensus in the Objective-C steering group that this is the right thing to do, but we're nonetheless okay with adding it because there's a substantial pool of Objective-C programmers who will appreciate the warning. Patch by Alfred Zien! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@341489 91177308-0d34-0410-b5e6-96231b3b80d8
* Model type attributes as regular Attrs.Richard Smith2018-08-201-2/+2
| | | | | | | | | | | | | | Specifically, AttributedType now tracks a regular attr::Kind rather than having its own parallel Kind enumeration, and AttributedTypeLoc now holds an Attr* instead of holding an ad-hoc collection of Attr fields. Differential Revision: https://reviews.llvm.org/D50526 This reinstates r339623, reverted in r339638, with a fix to not fail template instantiation if we instantiate a QualType with no associated type source information and we encounter an AttributedType. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@340215 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert r339623 "Model type attributes as regular Attrs."Reid Kleckner2018-08-141-2/+2
| | | | | | | | This breaks compiling atlwin.h in Chromium. I'm sure the code is invalid in some way, but we put a lot of work into accepting it, and I'm sure rejecting it was not an intended consequence of this refactoring. :) git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@339638 91177308-0d34-0410-b5e6-96231b3b80d8
* Model type attributes as regular Attrs.Richard Smith2018-08-131-2/+2
| | | | | | | | | | Specifically, AttributedType now tracks a regular attr::Kind rather than having its own parallel Kind enumeration, and AttributedTypeLoc now holds an Attr* instead of holding an ad-hoc collection of Attr fields. Differential Revision: https://reviews.llvm.org/D50526 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@339623 91177308-0d34-0410-b5e6-96231b3b80d8
* Port getLocEnd -> getEndLocStephen Kelly2018-08-091-2/+2
| | | | | | | | | | Reviewers: teemperor! Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D50351 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@339386 91177308-0d34-0410-b5e6-96231b3b80d8
* Port getLocStart -> getBeginLocStephen Kelly2018-08-091-5/+5
| | | | | | | | | | Reviewers: teemperor! Subscribers: jholewinski, whisperity, jfb, cfe-commits Differential Revision: https://reviews.llvm.org/D50350 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@339385 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove trailing spaceFangrui Song2018-07-301-69/+69
| | | | | | sed -Ei 's/[[:space:]]+$//' include/**/*.{def,h,td} lib/**/*.{cpp,h} git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@338291 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove \brief commands from doxygen comments.Adrian Prantl2018-05-091-2/+2
| | | | | | | | | | | | | | | | | | | This is similar to the LLVM change https://reviews.llvm.org/D46290. We've been running doxygen with the autobrief option for a couple of years now. This makes the \brief markers into our comments redundant. Since they are a visual distraction and we don't want to encourage more \brief markers in new code either, this patch removes them all. Patch produced by for i in $(git grep -l '\@brief'); do perl -pi -e 's/\@brief //g' $i & done for i in $(git grep -l '\\brief'); do perl -pi -e 's/\\brief //g' $i & done Differential Revision: https://reviews.llvm.org/D46320 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@331834 91177308-0d34-0410-b5e6-96231b3b80d8
* [ObjC] The absence of ownership qualifiers on an ambiguous property leadsAlex Lorenz2018-05-021-4/+14
| | | | | | | | | | to synthesis of a valid property even when the selected protocol property has ownership qualifiers rdar://39024725 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@331409 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove redundant casts. NFCGeorge Burgess IV2018-03-011-1/+1
| | | | | | | | | | | | | | | | | | | | So I wrote a clang-tidy check to lint out redundant `isa`, `cast`, and `dyn_cast`s for fun. This is a portion of what it found for clang; I plan to do similar cleanups in LLVM and other subprojects when I find time. Because of the volume of changes, I explicitly avoided making any change that wasn't highly local and obviously correct to me (e.g. we still have a number of foo(cast<Bar>(baz)) that I didn't touch, since overloading is a thing and the cast<Bar> did actually change the type -- just up the class hierarchy). I also tried to leave the types we were cast<>ing to somewhere nearby, in cases where it wasn't locally obvious what we were dealing with before. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@326416 91177308-0d34-0410-b5e6-96231b3b80d8
* [Sema] Add support for flexible array members in Obj-C.Volodymyr Sapsai2017-10-231-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Allow Obj-C ivars with incomplete array type but only as the last ivar. Also add a requirement for ivars that contain a flexible array member to be at the end of class too. It is possible to add in a subclass another ivar at the end but we'll emit a warning in this case. Also we'll emit a warning if a variable sized ivar is declared in class extension or in implementation because subclasses won't know they should avoid adding new ivars. In ARC incomplete array objects are treated as __unsafe_unretained so require them to be marked as such. Prohibit synthesizing ivars with flexible array members because order of synthesized ivars is not obvious and tricky to control. Spelling out ivar explicitly gives control to developers and helps to avoid surprises with unexpected ivar ordering. For C and C++ changed diagnostic to tell explicitly a field is not the last one and point to the next field. It is not as useful as in Obj-C but it is an improvement and it is consistent with Obj-C. For C for unions emit more specific err_flexible_array_union instead of generic err_field_incomplete. rdar://problem/21054495 Reviewers: rjmccall, theraven Reviewed By: rjmccall Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D38773 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@316381 91177308-0d34-0410-b5e6-96231b3b80d8
* [ObjC] Don't warn on readwrite properties with custom setters thatAlex Lorenz2017-10-061-1/+5
| | | | | | | | | override readonly properties from protocols rdar://34192541 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@315093 91177308-0d34-0410-b5e6-96231b3b80d8
* [ObjC] Check written attributes only when synthesizing ambiguous propertyAlex Lorenz2017-08-221-2/+2
| | | | | | | | | | | | | | | | | | This commit fixes a bug introduced in r307903. The attribute ambiguity checker that was introduced in r307903 checked all property attributes, which caused errors for source-compatible properties, like: @property (nonatomic, readonly) NSObject *prop; @property (nonatomic, readwrite) NSObject *prop; because the readwrite property would get implicit 'strong' attribute. The ambiguity checker should be concerned about explicitly specified attributes only. rdar://33748089 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@311443 91177308-0d34-0410-b5e6-96231b3b80d8
* [Sema] Silence -Wobjc-missing-property-synthesis for unavailable propertiesAlex Lorenz2017-08-151-1/+1
| | | | | | | rdar://30296911 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@310916 91177308-0d34-0410-b5e6-96231b3b80d8
* [ObjC] Pick a 'readwrite' property when synthesizing ambiguousAlex Lorenz2017-07-131-27/+160
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | property and check for incompatible attributes This commit changes the way ambiguous property synthesis (i.e. when synthesizing a property that's declared in multiple protocols) is performed. Previously, Clang synthesized the first property that was found. This lead to problems when the property was synthesized in a class that conformed to two protocols that declared that property and a second protocols had a 'readwrite' declaration - the setter was not synthesized so the class didn't really conform to the second protocol and user's code would crash at runtime when they would try to set the property. This commit ensures that a first readwrite property is selected. This is a semantic change that changes users code in this manner: ``` @protocol P @property(readonly) int p; @end @protocol P2 @property(readwrite) id p; @end @interface I <P2> @end @implementation I @syntesize p; // Users previously got a warning here, and Clang synthesized // readonly 'int p' here. Now Clang synthesizes readwrite 'id' p.. @end ``` To ensure that this change is safe, the warning about incompatible types is promoted to an error when this kind of readonly/readwrite ambiguity is detected in the @implementation. This will ensure that previous code that had this subtle bug and ignored the warning now will fail to compile with an error, and users should not get suprises at runtime once they resolve the error. The commit also extends the ambiguity checker, and now it can detect conflicts among the different property attributes. An error diagnostic is used for conflicting attributes, to ensure that the user won't get "suprises" at runtime. ProtocolPropertyMap is removed in favour of a a set + vector because the map's order of iteration is non-deterministic, so it couldn't be used to select the readwrite property. rdar://31579994 Differential Revision: https://reviews.llvm.org/D35268 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@307903 91177308-0d34-0410-b5e6-96231b3b80d8
* Add a fixit for -Wobjc-protocol-property-synthesisAlex Lorenz2017-07-031-4/+10
| | | | | | | | | rdar://32132756 Differential Revision: https://reviews.llvm.org/D34886 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@307014 91177308-0d34-0410-b5e6-96231b3b80d8
* [Sema][ObjC] Avoid the "type of property does not match type of accessor"Alex Lorenz2017-03-301-6/+3
| | | | | | | | | warning for methods that resemble the setters of readonly properties rdar://30415679 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@299078 91177308-0d34-0410-b5e6-96231b3b80d8
* [index/AST] Add references for ObjC getter=/setter= property attributes and ↵Argyrios Kyrtzidis2017-03-161-10/+18
| | | | | | | | | | | related property getter/setter role fixes This enhances the AST to keep track of locations of the names in those ObjC property attributes, and reports them for indexing. Patch by Nathan Hawes! https://reviews.llvm.org/D30907 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@297972 91177308-0d34-0410-b5e6-96231b3b80d8
* Move checks for creation of objects of abstract class type from the variousRichard Smith2016-12-151-2/+4
| | | | | | | | | | constructs that can do so into the initialization code. This fixes a number of different cases in which we used to fail to check for abstract types. Thanks to Tim Shen for inspiring the weird code that uncovered this! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@289753 91177308-0d34-0410-b5e6-96231b3b80d8
* Mass-rename the handful of error_* diagnostics to err_*.Richard Smith2016-12-021-21/+21
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@288545 91177308-0d34-0410-b5e6-96231b3b80d8
* [ObjC] Remove _Atomic from return type and parameter type ofAkira Hatanaka2016-05-261-8/+16
| | | | | | | | | | | | | | | objective-c properties. This fixes an assert in CodeGen that fires when the getter and setter functions for an objective-c property of type _Atomic(_Bool) are synthesized. rdar://problem/26322972 Differential Revision: http://reviews.llvm.org/D20407 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@270808 91177308-0d34-0410-b5e6-96231b3b80d8
* ObjectiveC Class Properties: warn if a class property accessor is mistakenly anManman Ren2016-05-181-12/+16
| | | | | | | | | | | | | | instance method. When diagnosing unimplemented class property, make sure we emit a warning when we only see an instance method with the right selector. Also warn when we only see a class method for an instance property. rdar://26141719 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@269968 91177308-0d34-0410-b5e6-96231b3b80d8
* ObjC class properties: add diagnostics for unimplemented class properties.Manman Ren2016-04-121-42/+62
| | | | | | | rdar://24711047 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@266146 91177308-0d34-0410-b5e6-96231b3b80d8
* ObjC: add getter/setter for class properties to global pool.Manman Ren2016-03-231-0/+5
| | | | | | | rdar://problem/25323072 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@264196 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix remaining Clang-tidy readability-redundant-control-flow warnings; other ↵Eugene Zelenko2016-02-121-5/+0
| | | | | | | | | minor fixes. Differential revision: http://reviews.llvm.org/D17218 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@260757 91177308-0d34-0410-b5e6-96231b3b80d8
* Class Property: warn for synthesize on a class property.Manman Ren2016-01-291-0/+4
| | | | | | | rdar://23891898 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@259226 91177308-0d34-0410-b5e6-96231b3b80d8
* Class Property: change PropertyMap to include isClassProperty.Manman Ren2016-01-281-17/+28
| | | | | | | | | | | | | | | PropertyMap used to map IdentifierInfo (name of the property) to ObjcPropertyDecl *. Now that a class property can have the same name as an instance property, we change PropertyMap to map a pair <IdentifierInfo *, unsigned> to ObjcPropertyDecl *. Also update a few places from iterating over instance_properties to iterating over all properties. rdar://23891898 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@259119 91177308-0d34-0410-b5e6-96231b3b80d8
* Class Property: class property and instance property can have the same name.Manman Ren2016-01-281-17/+26
| | | | | | | | | | | | | | | | | | | | Add "enum ObjCPropertyQueryKind" to a few APIs that used to only take the name of the property: ObjCPropertyDecl::findPropertyDecl, ObjCContainerDecl::FindPropertyDeclaration, ObjCInterfaceDecl::FindPropertyVisibleInPrimaryClass, ObjCImplDecl::FindPropertyImplDecl, and Sema::ActOnPropertyImplDecl. ObjCPropertyQueryKind currently has 3 values: OBJC_PR_query_unknown, OBJC_PR_query_instance, OBJC_PR_query_class This extra parameter specifies that we are looking for an instance property with the given name, or a class property with the given name, or any property with the given name (if both exist, the instance property will be returned). rdar://23891898 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@259070 91177308-0d34-0410-b5e6-96231b3b80d8
* Class Property: create accessors (class methods) for class property.Manman Ren2016-01-271-17/+40
| | | | | | | | | | Change a few places where we assume property accessors can only be instance methods. rdar://23891898 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@258980 91177308-0d34-0410-b5e6-96231b3b80d8
* Class Property: handle class properties.Manman Ren2016-01-271-2/+2
| | | | | | | | | At places where we handle instance properties, if necessary. rdar://23891898 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@258979 91177308-0d34-0410-b5e6-96231b3b80d8
* Class Property: parse property attribute (class).Manman Ren2016-01-261-0/+5
| | | | | | | | | | This is the third patch in a series of patches to support class properties in addition to instance properties in objective-c. rdar://23891898 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@258834 91177308-0d34-0410-b5e6-96231b3b80d8
* Use instance_properties instead of properties. NFC.Manman Ren2016-01-261-8/+8
| | | | | | | | | | | | All current properties are instance properties. This is the second patch in a series of patches to support class properties in addition to instance properties in objective-c. rdar://23891898 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@258824 91177308-0d34-0410-b5e6-96231b3b80d8
* ObjC properties: consider ownership of properties from protocols when ↵Douglas Gregor2015-12-181-0/+7
| | | | | | | | | | synthesizing. When determining whether ownership was explicitly written for a property when it is being synthesized, also consider that the original property might have come from a protocol. Fixes rdar://problem/23931441. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@255943 91177308-0d34-0410-b5e6-96231b3b80d8
* Objective-C properties: merge attributes when redeclaring 'readonly' as ↵Douglas Gregor2015-12-101-89/+158
| | | | | | | | | | | | | | 'readwrite' in an extension. r251874 stopped back-patching the AST when an Objective-C 'readonly' property is redeclared in a class extension as 'readwrite'. However, it did not properly handle merging of Objective-C property attributes (e.g., getter name, ownership, atomicity) to the redeclaration, leading to bad metadata. Merge (and check!) those property attributes so we get the right metadata and reasonable ASTs. Fixes rdar://problem/23823989. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@255309 91177308-0d34-0410-b5e6-96231b3b80d8
* Objective-C properties: loosen 'atomic' checking for readonly properties.Douglas Gregor2015-12-091-20/+53
| | | | | | | | | | | | | | | r251874 reworked the way we handle properties declared within Objective-C class extensions, which had the effective of tightening up property checking in a number of places. In this particular class of cases, we end up complaining about "atomic" mismatches between an implicitly-atomic, readonly property and a nonatomic, readwrite property, which doesn't make sense because "atomic" is essentially irrelevant to readonly properties. Therefore, suppress this diagnostic when the readonly property is implicitly atomic. Fixes rdar://problem/23803109. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@255174 91177308-0d34-0410-b5e6-96231b3b80d8
* Objective-C properties: fix bogus use of "isa<>" on a QualType.Douglas Gregor2015-12-081-6/+5
| | | | | | | | | | | The code used "isa" to check the type and then "getAs" to look through sugar; we need to look through the sugar when checking, too, otherwise any kind of sugar (nullability qualifiers in the example; or a typedef) will thwart this semantic check. Fixes rdar://problem/23804250. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@255066 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix a comment typo from r251874.Nico Weber2015-12-031-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@254579 91177308-0d34-0410-b5e6-96231b3b80d8
* Simplify Sema::ProcessPropertyDecl. NFCDouglas Gregor2015-11-031-21/+6
| | | | | | | | | Now that the properties created within Objective-C class extensions go into the extension themselves, we don't need any of the extra complexity here. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@251949 91177308-0d34-0410-b5e6-96231b3b80d8
* Stop back-patching 'readonly' Objective-C properties with 'readwrite' ones.Douglas Gregor2015-11-031-176/+136
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Be more conservative about diagnosing "incorrect" uses of __weak:John McCall2015-10-271-51/+76
| | | | | | | | | | | | allow them to be written in certain kinds of user declaration and diagnose on the use-site instead. Also, improve and fix some diagnostics relating to __weak and properties. rdar://23228631 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@251384 91177308-0d34-0410-b5e6-96231b3b80d8
* Define weak and __weak to mean ARC-style weak references, even in MRC.John McCall2015-10-221-38/+44
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously, __weak was silently accepted and ignored in MRC mode. That makes this a potentially source-breaking change that we have to roll out cautiously. Accordingly, for the time being, actual support for __weak references in MRC is experimental, and the compiler will reject attempts to actually form such references. The intent is to eventually enable the feature by default in all non-GC modes. (It is, of course, incompatible with ObjC GC's interpretation of __weak.) If you like, you can enable this feature with -Xclang -fobjc-weak but like any -Xclang option, this option may be removed at any point, e.g. if/when it is eventually enabled by default. This patch also enables the use of the ARC __unsafe_unretained qualifier in MRC. Unlike __weak, this is being enabled immediately. Since variables are essentially __unsafe_unretained by default in MRC, the only practical uses are (1) communication and (2) changing the default behavior of by-value block capture. As an implementation matter, this means that the ObjC ownership qualifiers may appear in any ObjC language mode, and so this patch removes a number of checks for getLangOpts().ObjCAutoRefCount that were guarding the processing of these qualifiers. I don't expect this to be a significant drain on performance; it may even be faster to just check for these qualifiers directly on a type (since it's probably in a register anyway) than to do N dependent loads to grab the LangOptions. rdar://9674298 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@251041 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix inference of _Nullable for weak Objective-C properties.Douglas Gregor2015-10-091-8/+1
| | | | | | | | | | | | | | | | | | | | | | The inference of _Nullable for weak Objective-C properties was broken in several ways: * It was back-patching the type information very late in the process of checking the attributes for an Objective-C property, which is just wrong. * It was using ad hoc checks to try to suppress the warning about missing nullability specifiers (-Wnullability-completeness), which didn't actual work in all cases (rdar://problem/22985457) * It was inferring _Nullable even outside of assumes-nonnull regions, which is wrong. Putting the inference of _Nullable for weak Objective-C properties in the same place as all of the other inference logic fixes all of these ills. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@249896 91177308-0d34-0410-b5e6-96231b3b80d8
* Replace double negation of !FileID.isInvalid() with FileID.isValid().Yaron Keren2015-10-031-1/+1
| | | | | | | | +couple more of double-negated !SourceLocation.isInvalid() unfixed in r249228. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@249235 91177308-0d34-0410-b5e6-96231b3b80d8