Revert "[Sema][ObjC] Warn about mismatches in attributes between overriding and"

This reverts commit 7bf83a7aaf926d17fdbb261ab63f1e84b35c21cc.

The noescape support cases build failures in some projects. We will take
those improvements in the next cycle.
diff --git a/include/clang/Basic/DiagnosticGroups.td b/include/clang/Basic/DiagnosticGroups.td
index 8283a59..9387ed2 100644
--- a/include/clang/Basic/DiagnosticGroups.td
+++ b/include/clang/Basic/DiagnosticGroups.td
@@ -483,9 +483,6 @@
                                     PragmaClangAttribute]>;
 def UnknownWarningOption : DiagGroup<"unknown-warning-option">;
 def NSobjectAttribute : DiagGroup<"NSObject-attribute">;
-def NSConsumedMismatch : DiagGroup<"nsconsumed-mismatch">;
-def NSReturnsMismatch : DiagGroup<"nsreturns-mismatch">;
-
 def IndependentClassAttribute : DiagGroup<"IndependentClass-attribute">;
 def UnknownAttributes : DiagGroup<"unknown-attributes">;
 def IgnoredAttributes : DiagGroup<"ignored-attributes">;
diff --git a/include/clang/Basic/DiagnosticSemaKinds.td b/include/clang/Basic/DiagnosticSemaKinds.td
index 794700b..c33bf18 100644
--- a/include/clang/Basic/DiagnosticSemaKinds.td
+++ b/include/clang/Basic/DiagnosticSemaKinds.td
@@ -8272,12 +8272,12 @@
   "feature, not permitted in C++">;
 def err_type_unsupported : Error<
   "%0 is not supported on this target">;
-def warn_nsconsumed_attribute_mismatch : Warning<
+def err_nsconsumed_attribute_mismatch : Error<
   "overriding method has mismatched ns_consumed attribute on its"
-  " parameter">, InGroup<NSConsumedMismatch>;
-def warn_nsreturns_retained_attribute_mismatch : Warning<
+  " parameter">;
+def err_nsreturns_retained_attribute_mismatch : Error<
   "overriding method has mismatched ns_returns_%select{not_retained|retained}0"
-  " attributes">, InGroup<NSReturnsMismatch>;
+  " attributes">;
 
 def err_nserrordomain_not_tagdecl : Error<
   "ns_error_domain attribute only valid on "
diff --git a/lib/Sema/SemaDeclObjC.cpp b/lib/Sema/SemaDeclObjC.cpp
index a756502..b132381 100644
--- a/lib/Sema/SemaDeclObjC.cpp
+++ b/lib/Sema/SemaDeclObjC.cpp
@@ -158,36 +158,34 @@
            diag::note_related_result_type_overridden);
   }
   if (getLangOpts().ObjCAutoRefCount) {
-    Diags.setSeverity(diag::warn_nsreturns_retained_attribute_mismatch,
-                      diag::Severity::Error, SourceLocation());
-    Diags.setSeverity(diag::warn_nsconsumed_attribute_mismatch,
-                      diag::Severity::Error, SourceLocation());
-  }
-
-  if ((NewMethod->hasAttr<NSReturnsRetainedAttr>() !=
-       Overridden->hasAttr<NSReturnsRetainedAttr>())) {
-    Diag(NewMethod->getLocation(),
-         diag::warn_nsreturns_retained_attribute_mismatch) << 1;
-    Diag(Overridden->getLocation(), diag::note_previous_decl) << "method";
-  }
-  if ((NewMethod->hasAttr<NSReturnsNotRetainedAttr>() !=
-       Overridden->hasAttr<NSReturnsNotRetainedAttr>())) {
-    Diag(NewMethod->getLocation(),
-         diag::warn_nsreturns_retained_attribute_mismatch) << 0;
-    Diag(Overridden->getLocation(), diag::note_previous_decl)  << "method";
-  }
-
-  ObjCMethodDecl::param_const_iterator oi = Overridden->param_begin(),
-                                       oe = Overridden->param_end();
-  for (ObjCMethodDecl::param_iterator ni = NewMethod->param_begin(),
-                                      ne = NewMethod->param_end();
-       ni != ne && oi != oe; ++ni, ++oi) {
-    const ParmVarDecl *oldDecl = (*oi);
-    ParmVarDecl *newDecl = (*ni);
-    if (newDecl->hasAttr<NSConsumedAttr>() !=
-        oldDecl->hasAttr<NSConsumedAttr>()) {
-      Diag(newDecl->getLocation(), diag::warn_nsconsumed_attribute_mismatch);
-      Diag(oldDecl->getLocation(), diag::note_previous_decl) << "parameter";
+    if ((NewMethod->hasAttr<NSReturnsRetainedAttr>() !=
+         Overridden->hasAttr<NSReturnsRetainedAttr>())) {
+        Diag(NewMethod->getLocation(),
+             diag::err_nsreturns_retained_attribute_mismatch) << 1;
+        Diag(Overridden->getLocation(), diag::note_previous_decl) 
+        << "method";
+    }
+    if ((NewMethod->hasAttr<NSReturnsNotRetainedAttr>() !=
+              Overridden->hasAttr<NSReturnsNotRetainedAttr>())) {
+        Diag(NewMethod->getLocation(),
+             diag::err_nsreturns_retained_attribute_mismatch) << 0;
+        Diag(Overridden->getLocation(), diag::note_previous_decl) 
+        << "method";
+    }
+    ObjCMethodDecl::param_const_iterator oi = Overridden->param_begin(),
+                                         oe = Overridden->param_end();
+    for (ObjCMethodDecl::param_iterator
+           ni = NewMethod->param_begin(), ne = NewMethod->param_end();
+         ni != ne && oi != oe; ++ni, ++oi) {
+      const ParmVarDecl *oldDecl = (*oi);
+      ParmVarDecl *newDecl = (*ni);
+      if (newDecl->hasAttr<NSConsumedAttr>() != 
+          oldDecl->hasAttr<NSConsumedAttr>()) {
+        Diag(newDecl->getLocation(),
+             diag::err_nsconsumed_attribute_mismatch);
+        Diag(oldDecl->getLocation(), diag::note_previous_decl) 
+          << "parameter";
+      }
     }
   }
 }
diff --git a/test/Analysis/retain-release.m b/test/Analysis/retain-release.m
index 4ac72ab..29af194 100644
--- a/test/Analysis/retain-release.m
+++ b/test/Analysis/retain-release.m
@@ -1776,15 +1776,15 @@
 
 // rdar://problem/8024350
 @protocol F18P
-- (id) clone; // expected-note 2 {{method declared here}}
+- (id) clone;
 @end
 @interface F18 : NSObject<F18P> @end
 @interface F18(Cat)
-- (id) clone NS_RETURNS_RETAINED; // expected-warning {{overriding method has mismatched ns_returns_retained attributes}}
+- (id) clone NS_RETURNS_RETAINED;
 @end
 
 @implementation F18
-- (id) clone { // expected-warning {{overriding method has mismatched ns_returns_retained attributes}}
+- (id) clone {
   return [F18 alloc];
 }
 @end
diff --git a/test/SemaObjC/arc-nsconsumed-errors.m b/test/SemaObjC/arc-nsconsumed-errors.m
index fd0d388..62e74aa 100644
--- a/test/SemaObjC/arc-nsconsumed-errors.m
+++ b/test/SemaObjC/arc-nsconsumed-errors.m
@@ -1,8 +1,6 @@
-// RUN: %clang_cc1 -fsyntax-only -fobjc-arc -verify -fblocks -triple x86_64-apple-darwin10.0.0 -DOBJCARC %s
-// RUN: %clang_cc1 -fsyntax-only -verify -fblocks -triple x86_64-apple-darwin10.0.0 %s
+// RUN: %clang_cc1 -fsyntax-only -fobjc-arc -verify -fblocks -triple x86_64-apple-darwin10.0.0 %s
 // rdar://10187884
 
-#ifdef OBJCARC
 typedef void (^blk)(id arg1, __attribute((ns_consumed)) id arg2);
 typedef void (^blk1)(__attribute((ns_consumed))id arg1, __attribute((ns_consumed)) id arg2);
 blk a = ^void (__attribute((ns_consumed)) id arg1, __attribute((ns_consumed)) id arg2){}; // expected-error {{incompatible block pointer types initializing}}
@@ -20,12 +18,3 @@
 blk1 c3 = ^void (__attribute((ns_consumed)) id arg1, __attribute((ns_consumed)) id arg2){};
 
 blk1 d4 = ^void (id arg1, id arg2) {}; // expected-error {{incompatible block pointer types initializing}}
-#else
-@interface Sub
--(void) m:(id)p; // expected-note {{parameter declared here}}
-@end
-
-@interface Super : Sub
--(void) m:(__attribute__((ns_consumed)) id)p; // expected-warning {{overriding method has mismatched ns_consumed attribute on its parameter}}
-@end
-#endif