diff options
author | Fariborz Jahanian <fjahanian@apple.com> | 2012-01-24 19:40:13 +0000 |
---|---|---|
committer | Fariborz Jahanian <fjahanian@apple.com> | 2012-01-24 19:40:13 +0000 |
commit | 466f45a06b654d85e9504e37ccf7255ffe4f0e2b (patch) | |
tree | aaf6fba35f8bfcbba0299639b07f3b0afedb3e4d | |
parent | b9ac30cf9ec001fd0d63ffc44289a333a21e691d (diff) | |
download | clang-466f45a06b654d85e9504e37ccf7255ffe4f0e2b.tar.gz |
objc: Issue a generic diagnostic assigning to
an objc object in any abi mode.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148847 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | include/clang/Basic/DiagnosticSemaKinds.td | 4 | ||||
-rw-r--r-- | lib/Sema/SemaExpr.cpp | 7 | ||||
-rw-r--r-- | test/SemaObjC/deref-interface.m | 2 | ||||
-rw-r--r-- | test/SemaObjCXX/fragile-abi-object-assign.m | 4 |
4 files changed, 5 insertions, 12 deletions
diff --git a/include/clang/Basic/DiagnosticSemaKinds.td b/include/clang/Basic/DiagnosticSemaKinds.td index b88bdaffd5..87522e5eb3 100644 --- a/include/clang/Basic/DiagnosticSemaKinds.td +++ b/include/clang/Basic/DiagnosticSemaKinds.td @@ -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< diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp index 9adf22ad2d..08439e1868 100644 --- a/lib/Sema/SemaExpr.cpp +++ b/lib/Sema/SemaExpr.cpp @@ -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" diff --git a/test/SemaObjC/deref-interface.m b/test/SemaObjC/deref-interface.m index 490e3a565d..1d6ed01dea 100644 --- a/test/SemaObjC/deref-interface.m +++ b/test/SemaObjC/deref-interface.m @@ -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 diff --git a/test/SemaObjCXX/fragile-abi-object-assign.m b/test/SemaObjCXX/fragile-abi-object-assign.m index 41f961d90f..953db6bbc0 100644 --- a/test/SemaObjCXX/fragile-abi-object-assign.m +++ b/test/SemaObjCXX/fragile-abi-object-assign.m @@ -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 |