AddFactoryMethodToGlobalPool(MDecl, true);
}
-/// StrongPointerToObjCPointer - returns true when pointer to ObjC pointer
-/// is __strong, or when it is any other type. It returns false when
-/// pointer to ObjC pointer is not __strong.
+/// HasExplicitOwnershipAttr - returns true when pointer to ObjC pointer
+/// has explicit ownership attribute; false otherwise.
static bool
-StrongPointerToObjCPointer(Sema &S, ParmVarDecl *Param) {
+HasExplicitOwnershipAttr(Sema &S, ParmVarDecl *Param) {
QualType T = Param->getType();
if (!T->isObjCIndirectLifetimeType())
return true;
? T->getAs<PointerType>()->getPointeeType()
: T->getAs<ReferenceType>()->getPointeeType();
if (T->isObjCLifetimeType()) {
- Qualifiers::ObjCLifetime lifetime = T.getObjCLifetime();
- return lifetime == Qualifiers::OCL_Strong;
+ // when lifetime is Qualifiers::OCL_None it means that it has
+ // no implicit ownership qualifier (which means it is explicit).
+ Qualifiers::ObjCLifetime lifetime =
+ T.getLocalQualifiers().getObjCLifetime();
+ return lifetime == Qualifiers::OCL_None;
}
return true;
}
Param->setInvalidDecl();
if (!Param->isInvalidDecl() &&
getLangOpts().ObjCAutoRefCount &&
- !StrongPointerToObjCPointer(*this, Param))
+ !HasExplicitOwnershipAttr(*this, Param))
Diag(Param->getLocation(), diag::warn_arc_strong_pointer_objc_pointer) <<
Param->getType();
- (void) N : (__strong NSObject***) arg0 : (__strong NSObject<P>***)arg : (float**) arg1 : (double) arg2 {}
- (void) BLOCK : (T*) arg0 : (T)arg : (__strong T*) arg1 {} // expected-warning {{method parameter of type '__autoreleasing T *' (aka 'void (^__autoreleasing *)()') with no explicit ownership}}
@end
+
+// rdar://12280826
+@class NSMutableDictionary, NSError;
+@interface Radar12280826
+- (void)createInferiorTransportAndSetEnvironment:(NSMutableDictionary*)environment error:(__autoreleasing NSError**)error;
+@end
+
+@implementation Radar12280826
+- (void)createInferiorTransportAndSetEnvironment:(NSMutableDictionary*)environment error:(__autoreleasing NSError**)error {}
+@end
+