@@ -50,11 +50,9 @@ class PropertiesRewriter {
50
50
51
51
enum PropActionKind {
52
52
PropAction_None,
53
- PropAction_RetainToStrong,
54
53
PropAction_RetainRemoved,
55
54
PropAction_AssignRemoved,
56
55
PropAction_AssignRewritten,
57
- PropAction_MaybeAddStrong,
58
56
PropAction_MaybeAddWeakOrUnsafe
59
57
};
60
58
@@ -163,18 +161,13 @@ class PropertiesRewriter {
163
161
switch (kind) {
164
162
case PropAction_None:
165
163
return ;
166
- case PropAction_RetainToStrong:
167
- rewriteAttribute (" retain" , " strong" , atLoc);
168
- return ;
169
164
case PropAction_RetainRemoved:
170
165
removeAttribute (" retain" , atLoc);
171
166
return ;
172
167
case PropAction_AssignRemoved:
173
168
return removeAssignForDefaultStrong (props, atLoc);
174
169
case PropAction_AssignRewritten:
175
170
return rewriteAssign (props, atLoc);
176
- case PropAction_MaybeAddStrong:
177
- return maybeAddStrongAttr (props, atLoc);
178
171
case PropAction_MaybeAddWeakOrUnsafe:
179
172
return maybeAddWeakOrUnsafeUnretainedAttr (props, atLoc);
180
173
}
@@ -199,11 +192,8 @@ class PropertiesRewriter {
199
192
return ;
200
193
201
194
if (propAttrs & ObjCPropertyDecl::OBJC_PR_retain) {
202
- if (propAttrs & ObjCPropertyDecl::OBJC_PR_readonly)
203
- return doPropAction (PropAction_RetainToStrong, props, atLoc);
204
- else
205
- // strong is the default.
206
- return doPropAction (PropAction_RetainRemoved, props, atLoc);
195
+ // strong is the default.
196
+ return doPropAction (PropAction_RetainRemoved, props, atLoc);
207
197
}
208
198
209
199
bool HasIvarAssignedAPlusOneObject = hasIvarAssignedAPlusOneObject (props);
@@ -258,17 +248,13 @@ class PropertiesRewriter {
258
248
259
249
void maybeAddWeakOrUnsafeUnretainedAttr (PropsTy &props,
260
250
SourceLocation atLoc) const {
261
- ObjCPropertyDecl::PropertyAttributeKind propAttrs = getPropertyAttrs (props);
262
-
263
251
bool canUseWeak = canApplyWeak (Pass.Ctx , getPropertyType (props),
264
252
/* AllowOnUnknownClass=*/ Pass.isGCMigration ());
265
- if (!(propAttrs & ObjCPropertyDecl::OBJC_PR_readonly) ||
266
- !hasAllIvarsBacked (props)) {
267
- bool addedAttr = addAttribute (canUseWeak ? " weak" : " unsafe_unretained" ,
268
- atLoc);
269
- if (!addedAttr)
270
- canUseWeak = false ;
271
- }
253
+
254
+ bool addedAttr = addAttribute (canUseWeak ? " weak" : " unsafe_unretained" ,
255
+ atLoc);
256
+ if (!addedAttr)
257
+ canUseWeak = false ;
272
258
273
259
for (PropsTy::iterator I = props.begin (), E = props.end (); I != E; ++I) {
274
260
if (isUserDeclared (I->IvarD ))
@@ -284,27 +270,6 @@ class PropertiesRewriter {
284
270
}
285
271
}
286
272
287
- void maybeAddStrongAttr (PropsTy &props, SourceLocation atLoc) const {
288
- ObjCPropertyDecl::PropertyAttributeKind propAttrs = getPropertyAttrs (props);
289
-
290
- if (!(propAttrs & ObjCPropertyDecl::OBJC_PR_readonly))
291
- return ; // 'strong' by default.
292
-
293
- if (!hasAllIvarsBacked (props)) {
294
- addAttribute (" strong" , atLoc);
295
- }
296
-
297
- for (PropsTy::iterator I = props.begin (), E = props.end (); I != E; ++I) {
298
- if (I->ImplD ) {
299
- Pass.TA .clearDiagnostic (diag::err_arc_assign_property_ownership,
300
- I->ImplD ->getLocation ());
301
- Pass.TA .clearDiagnostic (
302
- diag::err_arc_objc_property_default_assign_on_object,
303
- I->ImplD ->getLocation ());
304
- }
305
- }
306
- }
307
-
308
273
bool removeAttribute (StringRef fromAttr, SourceLocation atLoc) const {
309
274
return rewriteAttribute (fromAttr, StringRef (), atLoc);
310
275
}
0 commit comments