def err_synthesizing_arc_weak_property_no_runtime : Error<
"cannot synthesize weak property because the current deployment target "
"does not support weak references">;
-def warn_objc_weak_compat : Warning<
- "the meaning of __weak has changed in manual reference-counting">,
- InGroup<DiagGroup<"objc-weak-compat">>, DefaultIgnore;
def err_arc_unsupported_weak_class : Error<
"class is incompatible with __weak references">;
def err_arc_weak_unavailable_assign : Error<
type = S.Context.getAttributedType(AttributedType::attr_objc_ownership,
origType, type);
+ auto diagnoseOrDelay = [](Sema &S, SourceLocation loc,
+ unsigned diagnostic, QualType type) {
+ if (S.DelayedDiagnostics.shouldDelayDiagnostics()) {
+ S.DelayedDiagnostics.add(
+ sema::DelayedDiagnostic::makeForbiddenType(
+ S.getSourceManager().getExpansionLoc(loc),
+ diagnostic, type, /*ignored*/ 0));
+ } else {
+ S.Diag(loc, diagnostic);
+ }
+ };
+
// Sometimes, __weak isn't allowed.
if (lifetime == Qualifiers::OCL_Weak &&
!S.getLangOpts().ObjCWeak && !NonObjCPointer) {
: diag::err_arc_weak_no_runtime);
// In any case, delay the diagnostic until we know what we're parsing.
- if (S.DelayedDiagnostics.shouldDelayDiagnostics()) {
- S.DelayedDiagnostics.add(
- sema::DelayedDiagnostic::makeForbiddenType(
- S.getSourceManager().getExpansionLoc(AttrLoc),
- diagnostic, type, /*ignored*/ 0));
- } else {
- S.Diag(AttrLoc, diagnostic);
- }
+ diagnoseOrDelay(S, AttrLoc, diagnostic, type);
attr.setInvalid();
return true;
}
- // If we accepted __weak, we might still need to warn about it.
- if (lifetime == Qualifiers::OCL_Weak &&
- !S.getLangOpts().ObjCAutoRefCount &&
- S.getLangOpts().ObjCWeak) {
- S.Diag(AttrLoc, diag::warn_objc_weak_compat);
- }
-
// Forbid __weak for class objects marked as
// objc_arc_weak_reference_unavailable
if (lifetime == Qualifiers::OCL_Weak) {