[cfe-commits] r148823 - in /cfe/trunk: include/clang/Basic/DiagnosticSemaKinds.td lib/Sema/SemaExpr.cpp test/SemaObjCXX/fragile-abi-object-assign.m
kremenek at apple.com
Tue Jan 24 11:25:28 PST 2012
On Jan 24, 2012, at 11:11 AM, Douglas Gregor wrote:
> On Jan 24, 2012, at 10:05 AM, Fariborz Jahanian wrote:
>> Author: fjahanian
>> Date: Tue Jan 24 12:05:45 2012
>> New Revision: 148823
>> URL: http://llvm.org/viewvc/llvm-project?rev=148823&view=rev
>> objc: issue error if assigning objects in fragile-abi too.
>> // rdar://10731065
>> Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=148823&r1=148822&r2=148823&view=diff
>> --- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)
>> +++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Tue Jan 24 12:05:45 2012
>> @@ -3608,6 +3608,8 @@
>> 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">;
> Do we really want to suggest that users use memcpy to copy Objective-C objects? That seems… horribly error-prone, and not at all recommended because it will break under the non-fragile ABI. How about just complaining that classes cannot be assigned at all? If some clever user wants to shoot himself in the foot by using memcpy, at least we don't want to be blamed for giving him the gun...
Agreed. People should just stop doing this. Suggesting them to use memcpy is just as bad as the original idiom.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the cfe-commits