def warn_arc_perform_selector_leaks : Warning<
"performSelector may cause a leak because its selector is unknown">,
InGroup<DiagGroup<"arc-performSelector-leaks">>;
+def err_gc_weak_property_strong_type : Error<
+ "weak attribute declared on a __strong type property"
+ "in GC mode">;
def error_synthesized_ivar_yet_not_supported : Error<
"instance variable synthesis not yet supported"
ObjCPropertyDecl::PropertyAttributeKind kind
= property->getPropertyAttributes();
QualType PropType = Context.getCanonicalType(property->getType());
- bool PropertyIsGCWeak = (kind & ObjCPropertyDecl::OBJC_PR_weak &&
- !getLangOptions().ObjCAutoRefCount &&
- getLangOptions().getGCMode() !=
- LangOptions::NonGC);
- if (PropertyIsGCWeak && !PropType.isObjCGCStrong())
- PropType = Context.getObjCGCQualType(PropType, Qualifiers::Weak);
+
+ if ((kind & ObjCPropertyDecl::OBJC_PR_weak) &&
+ !getLangOptions().ObjCAutoRefCount &&
+ getLangOptions().getGCMode() != LangOptions::NonGC) {
+ if (PropType.isObjCGCStrong()) {
+ Diag(PropertyLoc,
+ diag::err_gc_weak_property_strong_type);
+ Diag(property->getLocation(), diag::note_property_declare);
+ }
+ else
+ PropType = Context.getObjCGCQualType(PropType, Qualifiers::Weak);
+ }
QualType PropertyIvarType = PropType;
if (PropType->isReferenceType())
PropertyIvarType = cast<ReferenceType>(PropType)->getPointeeType();
getLangOptions().getGCMode() != LangOptions::NonGC)) {
Diag(PropertyLoc, diag::error_weak_property)
<< property->getDeclName() << Ivar->getDeclName();
+ Diag(Ivar->getLocation(), diag::note_ivar_decl);
// Fall thru - see previous comment
}
// Fall thru - see previous comment