]> granicus.if.org Git - clang/commitdiff
objc: Issue a generic diagnostic assigning to
authorFariborz Jahanian <fjahanian@apple.com>
Tue, 24 Jan 2012 19:40:13 +0000 (19:40 +0000)
committerFariborz Jahanian <fjahanian@apple.com>
Tue, 24 Jan 2012 19:40:13 +0000 (19:40 +0000)
an objc object in any abi mode.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148847 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/Basic/DiagnosticSemaKinds.td
lib/Sema/SemaExpr.cpp
test/SemaObjC/deref-interface.m
test/SemaObjCXX/fragile-abi-object-assign.m

index b88bdaffd556753a9d91085b7ac510cfb2092aa1..87522e5eb39a6f9fbba0b8ebb2bfdca69262ec32 100644 (file)
@@ -3606,10 +3606,8 @@ def warn_pointer_indirection_from_incompatible_type : Warning<
   "behavior.">,
   InGroup<DiagGroup<"undefined-reinterpret-cast">>, DefaultIgnore;
 
-def err_assignment_requires_nonfragile_object : Error<
-  "cannot assign to class object in non-fragile ABI (%0 invalid)">;
 def err_objc_object_assignment : Error<
-  "cannot assign to class object - use memcpy instead">;
+  "cannot assign to class object (%0 invalid)">;
 def err_direct_interface_unsupported : Error<
   "indirection to an interface is not supported (%0 invalid)">;
 def err_typecheck_invalid_operands : Error<
index 9adf22ad2da78103675c4896ed370085d761e8cf..08439e18682a732babe1ee31bd14531b59c4632d 100644 (file)
@@ -7252,14 +7252,9 @@ QualType Sema::CheckAssignmentOperands(Expr *LHSExpr, ExprResult &RHS,
       ConvTy = Compatible;
 
     if (ConvTy == Compatible &&
-        LHSType->isObjCObjectType()) {
-      if (getLangOptions().ObjCNonFragileABI)
-        Diag(Loc, diag::err_assignment_requires_nonfragile_object)
-          << LHSType;
-      else
+        LHSType->isObjCObjectType())
         Diag(Loc, diag::err_objc_object_assignment)
           << LHSType;
-    }
 
     // If the RHS is a unary plus or minus, check to see if they = and + are
     // right next to each other.  If so, the user may have typo'd "x =+ 4"
index 490e3a565d2ecd7bcfb483ab9e64e3716a40fbbc..1d6ed01deaf8d82aa3cbfbc95205e411d6b3284f 100644 (file)
@@ -6,7 +6,7 @@
 
 @implementation NSView
  - (id)initWithView:(id)realView {
-     *(NSView *)self = *(NSView *)realView;    // expected-error {{cannot assign to class object in non-fragile ABI}}
+     *(NSView *)self = *(NSView *)realView;    // expected-error {{cannot assign to class object}}
  }
 @end
 
index 41f961d90f99a2fc9e8e478d443fe1ced06dd09d..953db6bbc06d3f6e5bd7308941771ea340f5ce83 100644 (file)
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -triple x86_64-apple-darwin11 -fsyntax-only -fobjc-fragile-abi -verify %s
+// RUN: %clang_cc1 -x objective-c++ -triple x86_64-apple-darwin11 -fsyntax-only -fobjc-fragile-abi -verify %s
 // rdar://10731065
 
 @interface MyView {}
@@ -7,7 +7,7 @@
 @implementation MyViewTemplate // expected-warning {{cannot find interface declaration for 'MyViewTemplate'}}
 - (id) createRealObject {
   id realObj;
-  *(MyView *) realObj = *(MyView *) self; // expected-error {{cannot assign to class object - use memcpy instead}}
+  *(MyView *) realObj = *(MyView *) self; // expected-error {{cannot assign to class object}}
 }
 @end