r252971 - Remove -Wobjc-weak-compat; there isn't a compelling use case for this.

John McCall via cfe-commits cfe-commits at lists.llvm.org
Thu Nov 12 15:39:39 PST 2015


Author: rjmccall
Date: Thu Nov 12 17:39:39 2015
New Revision: 252971

URL: http://llvm.org/viewvc/llvm-project?rev=252971&view=rev
Log:
Remove -Wobjc-weak-compat; there isn't a compelling use case for this.

Modified:
    cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
    cfe/trunk/lib/Sema/SemaType.cpp
    cfe/trunk/test/SemaObjC/property-in-class-extension-1.m

Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=252971&r1=252970&r2=252971&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Thu Nov 12 17:39:39 2015
@@ -4561,9 +4561,6 @@ def err_synthesizing_arc_weak_property_d
 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<

Modified: cfe/trunk/lib/Sema/SemaType.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaType.cpp?rev=252971&r1=252970&r2=252971&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaType.cpp (original)
+++ cfe/trunk/lib/Sema/SemaType.cpp Thu Nov 12 17:39:39 2015
@@ -5187,6 +5187,18 @@ static bool handleObjCOwnershipTypeAttr(
     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) {
@@ -5197,26 +5209,12 @@ static bool handleObjCOwnershipTypeAttr(
                                        : 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) {

Modified: cfe/trunk/test/SemaObjC/property-in-class-extension-1.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/property-in-class-extension-1.m?rev=252971&r1=252970&r2=252971&view=diff
==============================================================================
--- cfe/trunk/test/SemaObjC/property-in-class-extension-1.m (original)
+++ cfe/trunk/test/SemaObjC/property-in-class-extension-1.m Thu Nov 12 17:39:39 2015
@@ -1,5 +1,5 @@
-// RUN: %clang_cc1  -fsyntax-only -triple x86_64-apple-darwin11 -fobjc-runtime-has-weak -fobjc-weak -verify -Weverything -Wno-objc-weak-compat  %s
-// RUN: %clang_cc1 -x objective-c++ -triple x86_64-apple-darwin11 -fobjc-runtime-has-weak -fobjc-weak -fsyntax-only -verify -Weverything -Wno-objc-weak-compat %s
+// RUN: %clang_cc1  -fsyntax-only -triple x86_64-apple-darwin11 -fobjc-runtime-has-weak -fobjc-weak -verify -Weverything %s
+// RUN: %clang_cc1 -x objective-c++ -triple x86_64-apple-darwin11 -fobjc-runtime-has-weak -fobjc-weak -fsyntax-only -verify -Weverything %s
 // rdar://12103400
 
 @class NSString;




More information about the cfe-commits mailing list