[cfe-commits] r148847 - in /cfe/trunk: include/clang/Basic/DiagnosticSemaKinds.td lib/Sema/SemaExpr.cpp test/SemaObjC/deref-interface.m test/SemaObjCXX/fragile-abi-object-assign.m

Fariborz Jahanian fjahanian at apple.com
Tue Jan 24 11:40:13 PST 2012


Author: fjahanian
Date: Tue Jan 24 13:40:13 2012
New Revision: 148847

URL: http://llvm.org/viewvc/llvm-project?rev=148847&view=rev
Log:
objc: Issue a generic diagnostic assigning to 
an objc object in any abi mode.

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

Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=148847&r1=148846&r2=148847&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Tue Jan 24 13:40:13 2012
@@ -3606,10 +3606,8 @@
   "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<

Modified: cfe/trunk/lib/Sema/SemaExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExpr.cpp?rev=148847&r1=148846&r2=148847&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaExpr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExpr.cpp Tue Jan 24 13:40:13 2012
@@ -7252,14 +7252,9 @@
       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"

Modified: cfe/trunk/test/SemaObjC/deref-interface.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/deref-interface.m?rev=148847&r1=148846&r2=148847&view=diff
==============================================================================
--- cfe/trunk/test/SemaObjC/deref-interface.m (original)
+++ cfe/trunk/test/SemaObjC/deref-interface.m Tue Jan 24 13:40:13 2012
@@ -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
 

Modified: cfe/trunk/test/SemaObjCXX/fragile-abi-object-assign.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjCXX/fragile-abi-object-assign.m?rev=148847&r1=148846&r2=148847&view=diff
==============================================================================
--- cfe/trunk/test/SemaObjCXX/fragile-abi-object-assign.m (original)
+++ cfe/trunk/test/SemaObjCXX/fragile-abi-object-assign.m Tue Jan 24 13:40:13 2012
@@ -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
 





More information about the cfe-commits mailing list