[cfe-commits] r163917 - in /cfe/trunk: include/clang/Basic/DiagnosticGroups.td include/clang/Basic/DiagnosticSemaKinds.td lib/Sema/SemaDecl.cpp lib/Sema/SemaExprCXX.cpp test/ARCMT/cxx-checking.mm test/SemaObjCXX/arc-non-pod.mm test/SemaObjCXX/arc

Jean-Daniel Dupas devlists at shadowlab.org
Fri Oct 19 01:08:57 PDT 2012


You may workaround this issue by using a custom compiler definition (xcspec).

To create a custom clang definition:

Copy the builtin definition (/Applications/Xcode.app/Contents/PlugIns/Xcode3Core.ideplugin/Contents/SharedSupport/Developer/Library/Xcode/Plug-ins/Clang LLVM 1.0.xcplugin).

Update it by changing its name and identifier in the Info.plist, and by renaming the xcspec files in the bundle to make it match the name in Info.plist.

Move your custom definition in /Library/Application Support/Developer/Shared/Xcode/Plug-ins and restart Xcode. It should now propose a new compiler in the build settings.

By doing this, you will be able to change the following block in the xcspec file:

            {
                Name = "CLANG_WARN_OBJCPP_ARC_ABI";
                Type = Boolean;
                DefaultValue = NO;
                CommandLineArgs = {
                  YES = ( "-Warc-abi" );
                  NO = ( "-Wno-arc-abi" );
                };
                FileTypes = (
                  "sourcecode.cpp.objcpp",
                );
                Category = WarningsObjC;
            },

Replace 

NO = ( "-Wno-arc-abi" );

by 

NO = (  );

and you should no longer see this warning.

Le 19 oct. 2012 à 05:42, Nico Weber <thakis at chromium.org> a écrit :

> Hi,
> 
> Xcode 4.5 passes -Wno-arc-abi to clang, which makes a clang newer than
> r163917 warn that it doesn't understand -Wno-arc-abi. Would you guys
> hate it if we added a no-op -Warc-abi flag back until an Xcode ships
> that no longer adds -Wno-arc-abi?
> 
> I understand running head clang with xcode isn't supported, but this
> would add just add two lines for a limited amount of time and it'd
> make our live a bit easier.
> 
> Nico
> 
> On Fri, Sep 14, 2012 at 10:48 AM, Fariborz Jahanian <fjahanian at apple.com> wrote:
>> Author: fjahanian
>> Date: Fri Sep 14 12:48:35 2012
>> New Revision: 163917
>> 
>> URL: http://llvm.org/viewvc/llvm-project?rev=163917&view=rev
>> Log:
>> objective-C arc: remove -Warc-abi in its entirety.
>> // rdar://10554025
>> 
>> Removed:
>>    cfe/trunk/test/SemaObjCXX/arc-object-init-destroy.mm
>> Modified:
>>    cfe/trunk/include/clang/Basic/DiagnosticGroups.td
>>    cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
>>    cfe/trunk/lib/Sema/SemaDecl.cpp
>>    cfe/trunk/lib/Sema/SemaExprCXX.cpp
>>    cfe/trunk/test/ARCMT/cxx-checking.mm
>>    cfe/trunk/test/SemaObjCXX/arc-non-pod.mm
>> 
>> Modified: cfe/trunk/include/clang/Basic/DiagnosticGroups.td
>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticGroups.td?rev=163917&r1=163916&r2=163917&view=diff
>> ==============================================================================
>> --- cfe/trunk/include/clang/Basic/DiagnosticGroups.td (original)
>> +++ cfe/trunk/include/clang/Basic/DiagnosticGroups.td Fri Sep 14 12:48:35 2012
>> @@ -266,13 +266,11 @@
>> def CustomAtomic : DiagGroup<"custom-atomic-properties">;
>> def AtomicProperties : DiagGroup<"atomic-properties",
>>                                  [ImplicitAtomic, CustomAtomic]>;
>> -def AutomaticReferenceCountingABI : DiagGroup<"arc-abi">;
>> def ARCUnsafeRetainedAssign : DiagGroup<"arc-unsafe-retained-assign">;
>> def ARCRetainCycles : DiagGroup<"arc-retain-cycles">;
>> def ARCNonPodMemAccess : DiagGroup<"arc-non-pod-memaccess">;
>> def AutomaticReferenceCounting : DiagGroup<"arc",
>> -                                           [AutomaticReferenceCountingABI,
>> -                                            ARCUnsafeRetainedAssign,
>> +                                           [ARCUnsafeRetainedAssign,
>>                                             ARCRetainCycles,
>>                                             ARCNonPodMemAccess]>;
>> def Selector : DiagGroup<"selector">;
>> 
>> Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=163917&r1=163916&r2=163917&view=diff
>> ==============================================================================
>> --- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)
>> +++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Fri Sep 14 12:48:35 2012
>> @@ -3607,11 +3607,6 @@
>> def err_typecheck_arr_assign_enumeration : Error<
>>   "fast enumeration variables can't be modified in ARC by default; "
>>   "declare the variable __strong to allow this">;
>> -def warn_arc_non_pod_class_with_object_member : Warning<
>> -  "%0 cannot be shared between ARC and non-ARC "
>> -  "code; add a copy constructor, a copy assignment operator, and a destructor "
>> -  "to make it ABI-compatible">, InGroup<AutomaticReferenceCountingABI>,
>> -  DefaultIgnore;
>> def warn_arc_retained_assign : Warning<
>>   "assigning retained object to %select{weak|unsafe_unretained}0 "
>>   "%select{property|variable}1"
>> @@ -3621,17 +3616,8 @@
>>   "assigning retained object to unsafe property"
>>   "; object will be released after assignment">,
>>   InGroup<ARCUnsafeRetainedAssign>;
>> -def warn_arc_trivial_member_function_with_object_member : Warning<
>> -  "%0 cannot be shared between ARC and non-ARC "
>> -  "code; add a non-trivial %select{copy constructor|copy assignment operator|"
>> -  "destructor}1 to make it ABI-compatible">,
>> -  InGroup<AutomaticReferenceCountingABI>, DefaultIgnore;
>> def err_arc_new_array_without_ownership : Error<
>>   "'new' cannot allocate an array of %0 with no explicit ownership">;
>> -def warn_err_new_delete_object_array : Warning<
>> -  "%select{allocating|destroying}0 an array of %1; this array must not "
>> -  "%select{be deleted in|have been allocated from}0 non-ARC code">,
>> -  InGroup<AutomaticReferenceCountingABI>, DefaultIgnore;
>> def err_arc_autoreleasing_var : Error<
>>   "%select{__block variables|global variables|fields|ivars}0 cannot have "
>>   "__autoreleasing ownership">;
>> 
>> Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=163917&r1=163916&r2=163917&view=diff
>> ==============================================================================
>> --- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
>> +++ cfe/trunk/lib/Sema/SemaDecl.cpp Fri Sep 14 12:48:35 2012
>> @@ -10117,42 +10117,6 @@
>>           Convs->setAccess(I, (*I)->getAccess());
>> 
>>         if (!CXXRecord->isDependentType()) {
>> -          // Objective-C Automatic Reference Counting:
>> -          //   If a class has a non-static data member of Objective-C pointer
>> -          //   type (or array thereof), it is a non-POD type and its
>> -          //   default constructor (if any), copy constructor, copy assignment
>> -          //   operator, and destructor are non-trivial.
>> -          //
>> -          // This rule is also handled by CXXRecordDecl::completeDefinition().
>> -          // However, here we check whether this particular class is only
>> -          // non-POD because of the presence of an Objective-C pointer member.
>> -          // If so, objects of this type cannot be shared between code compiled
>> -          // with ARC and code compiled with manual retain/release.
>> -          if (getLangOpts().ObjCAutoRefCount &&
>> -              CXXRecord->hasObjectMember() &&
>> -              CXXRecord->getLinkage() == ExternalLinkage) {
>> -            if (CXXRecord->isPOD()) {
>> -              Diag(CXXRecord->getLocation(),
>> -                   diag::warn_arc_non_pod_class_with_object_member)
>> -               << CXXRecord;
>> -            } else {
>> -              // FIXME: Fix-Its would be nice here, but finding a good location
>> -              // for them is going to be tricky.
>> -              if (CXXRecord->hasTrivialCopyConstructor())
>> -                Diag(CXXRecord->getLocation(),
>> -                     diag::warn_arc_trivial_member_function_with_object_member)
>> -                  << CXXRecord << 0;
>> -              if (CXXRecord->hasTrivialCopyAssignment())
>> -                Diag(CXXRecord->getLocation(),
>> -                     diag::warn_arc_trivial_member_function_with_object_member)
>> -                << CXXRecord << 1;
>> -              if (CXXRecord->hasTrivialDestructor())
>> -                Diag(CXXRecord->getLocation(),
>> -                     diag::warn_arc_trivial_member_function_with_object_member)
>> -                << CXXRecord << 2;
>> -            }
>> -          }
>> -
>>           // Adjust user-defined destructor exception spec.
>>           if (getLangOpts().CPlusPlus0x &&
>>               CXXRecord->hasUserDeclaredDestructor())
>> 
>> Modified: cfe/trunk/lib/Sema/SemaExprCXX.cpp
>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExprCXX.cpp?rev=163917&r1=163916&r2=163917&view=diff
>> ==============================================================================
>> --- cfe/trunk/lib/Sema/SemaExprCXX.cpp (original)
>> +++ cfe/trunk/lib/Sema/SemaExprCXX.cpp Fri Sep 14 12:48:35 2012
>> @@ -1275,14 +1275,6 @@
>>       }
>>     }
>> 
>> -    // ARC: warn about ABI issues.
>> -    if (getLangOpts().ObjCAutoRefCount) {
>> -      QualType BaseAllocType = Context.getBaseElementType(AllocType);
>> -      if (BaseAllocType.hasStrongOrWeakObjCLifetime())
>> -        Diag(StartLoc, diag::warn_err_new_delete_object_array)
>> -          << 0 << BaseAllocType;
>> -    }
>> -
>>     // Note that we do *not* convert the argument in any way.  It can
>>     // be signed, larger than size_t, whatever.
>>   }
>> @@ -2206,13 +2198,6 @@
>>         }
>>       }
>> 
>> -    } else if (getLangOpts().ObjCAutoRefCount &&
>> -               PointeeElem->isObjCLifetimeType() &&
>> -               (PointeeElem.getObjCLifetime() == Qualifiers::OCL_Strong ||
>> -                PointeeElem.getObjCLifetime() == Qualifiers::OCL_Weak) &&
>> -               ArrayForm) {
>> -      Diag(StartLoc, diag::warn_err_new_delete_object_array)
>> -        << 1 << PointeeElem;
>>     }
>> 
>>     if (!OperatorDelete) {
>> 
>> Modified: cfe/trunk/test/ARCMT/cxx-checking.mm
>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/ARCMT/cxx-checking.mm?rev=163917&r1=163916&r2=163917&view=diff
>> ==============================================================================
>> --- cfe/trunk/test/ARCMT/cxx-checking.mm (original)
>> +++ cfe/trunk/test/ARCMT/cxx-checking.mm Fri Sep 14 12:48:35 2012
>> @@ -1,16 +1,16 @@
>> -// RUN: %clang_cc1 -arcmt-check -verify -triple x86_64-apple-darwin10 -fsyntax-only -fblocks -Warc-abi  %s
>> +// RUN: %clang_cc1 -arcmt-check -verify -triple x86_64-apple-darwin10 -fsyntax-only -fblocks %s
>> // DISABLE: mingw32
>> 
>> // Classes that have an Objective-C object pointer.
>> -struct HasObjectMember0 { // expected-warning{{'HasObjectMember0' cannot be shared between ARC and non-ARC code; add a copy constructor, a copy assignment operator, and a destructor to make it ABI-compatible}}
>> +struct HasObjectMember0 {
>>   id x;
>> };
>> 
>> -struct HasObjectMember1 { // expected-warning{{'HasObjectMember1' cannot be shared between ARC and non-ARC code; add a copy constructor, a copy assignment operator, and a destructor to make it ABI-compatible}}
>> +struct HasObjectMember1 {
>>   id x[3];
>> };
>> 
>> -struct HasObjectMember2 { // expected-warning{{'HasObjectMember2' cannot be shared between ARC and non-ARC code; add a copy constructor, a copy assignment operator, and a destructor to make it ABI-compatible}}
>> +struct HasObjectMember2 {
>>   id x[3][2];
>> };
>> 
>> @@ -27,11 +27,11 @@
>>   __unsafe_unretained id x[3][2];
>> };
>> 
>> -struct HasBlockPointerMember0 { // expected-warning{{'HasBlockPointerMember0' cannot be shared between ARC and non-ARC code; add a copy constructor, a copy assignment operator, and a destructor to make it ABI-compatible}}
>> +struct HasBlockPointerMember0 {
>>   int (^bp)(int);
>> };
>> 
>> -struct HasBlockPointerMember1 { // expected-warning{{'HasBlockPointerMember1' cannot be shared between ARC and non-ARC code; add a copy constructor, a copy assignment operator, and a destructor to make it ABI-compatible}}
>> +struct HasBlockPointerMember1 {
>>   int (^bp[2][3])(int);
>> };
>> 
>> @@ -39,20 +39,17 @@
>>   NonPOD(const NonPOD&);
>> };
>> 
>> -struct HasObjectMemberAndNonPOD0 { // expected-warning{{'HasObjectMemberAndNonPOD0' cannot be shared between ARC and non-ARC code; add a non-trivial copy assignment operator to make it ABI-compatible}} \
>> -  // expected-warning{{'HasObjectMemberAndNonPOD0' cannot be shared between ARC and non-ARC code; add a non-trivial destructor to make it ABI-compatible}}
>> +struct HasObjectMemberAndNonPOD0 {
>>   id x;
>>   NonPOD np;
>> };
>> 
>> -struct HasObjectMemberAndNonPOD1 { // expected-warning{{'HasObjectMemberAndNonPOD1' cannot be shared between ARC and non-ARC code; add a non-trivial copy assignment operator to make it ABI-compatible}} \
>> -  // expected-warning{{'HasObjectMemberAndNonPOD1' cannot be shared between ARC and non-ARC code; add a non-trivial destructor to make it ABI-compatible}}
>> +struct HasObjectMemberAndNonPOD1 {
>>   NonPOD np;
>>   id x[3];
>> };
>> 
>> -struct HasObjectMemberAndNonPOD2 { // expected-warning{{'HasObjectMemberAndNonPOD2' cannot be shared between ARC and non-ARC code; add a non-trivial copy assignment operator to make it ABI-compatible}} \
>> -  // expected-warning{{'HasObjectMemberAndNonPOD2' cannot be shared between ARC and non-ARC code; add a non-trivial destructor to make it ABI-compatible}}
>> +struct HasObjectMemberAndNonPOD2 {
>>   NonPOD np;
>>   id x[3][2];
>> };
>> @@ -64,14 +61,12 @@
>>   id x[3][2];
>> };
>> 
>> -struct HasBlockPointerMemberAndNonPOD0 { // expected-warning{{'HasBlockPointerMemberAndNonPOD0' cannot be shared between ARC and non-ARC code; add a non-trivial copy assignment operator to make it ABI-compatible}} \
>> -// expected-warning{{'HasBlockPointerMemberAndNonPOD0' cannot be shared between ARC and non-ARC code; add a non-trivial destructor to make it ABI-compatible}}
>> +struct HasBlockPointerMemberAndNonPOD0 {
>>   NonPOD np;
>>   int (^bp)(int);
>> };
>> 
>> -struct HasBlockPointerMemberAndNonPOD1 { // expected-warning{{'HasBlockPointerMemberAndNonPOD1' cannot be shared between ARC and non-ARC code; add a non-trivial copy assignment operator to make it ABI-compatible}} \
>> -// expected-warning{{'HasBlockPointerMemberAndNonPOD1' cannot be shared between ARC and non-ARC code; add a non-trivial destructor to make it ABI-compatible}}
>> +struct HasBlockPointerMemberAndNonPOD1 {
>>   NonPOD np;
>>   int (^bp[2][3])(int);
>> };
>> 
>> Modified: cfe/trunk/test/SemaObjCXX/arc-non-pod.mm
>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjCXX/arc-non-pod.mm?rev=163917&r1=163916&r2=163917&view=diff
>> ==============================================================================
>> --- cfe/trunk/test/SemaObjCXX/arc-non-pod.mm (original)
>> +++ cfe/trunk/test/SemaObjCXX/arc-non-pod.mm Fri Sep 14 12:48:35 2012
>> @@ -1,4 +1,4 @@
>> -// RUN: %clang_cc1 -fsyntax-only -fobjc-arc -Warc-abi -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
>> 
>> // Classes that have an Objective-C object pointer.
>> struct HasObjectMember0 { // expected-warning{{'HasObjectMember0' cannot be shared between ARC and non-ARC code; add a copy constructor, a copy assignment operator, and a destructor to make it ABI-compatible}}
>> 
>> Removed: cfe/trunk/test/SemaObjCXX/arc-object-init-destroy.mm
>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjCXX/arc-object-init-destroy.mm?rev=163916&view=auto
>> ==============================================================================
>> --- cfe/trunk/test/SemaObjCXX/arc-object-init-destroy.mm (original)
>> +++ cfe/trunk/test/SemaObjCXX/arc-object-init-destroy.mm (removed)
>> @@ -1,52 +0,0 @@
>> -// RUN: %clang_cc1 -fobjc-runtime-has-weak -fsyntax-only -fobjc-arc -verify -Warc-abi -fblocks -triple x86_64-apple-darwin10.0.0 %s
>> -
>> -typedef __strong id strong_id;
>> -typedef __weak id weak_id;
>> -void test_pseudo_destructors(__strong id *sptr, __weak id *wptr) {
>> -  sptr->~id(); // okay
>> -  wptr->~id(); // okay
>> -  sptr->~strong_id(); // okay
>> -  wptr->~weak_id();
>> -  sptr->~weak_id(); // expected-error{{pseudo-destructor destroys object of type '__strong id' with inconsistently-qualified type 'weak_id' (aka '__weak id')}}
>> -  wptr->strong_id::~strong_id(); // expected-error{{pseudo-destructor destroys object of type '__weak id' with inconsistently-qualified type 'strong_id' (aka '__strong id')}}
>> -
>> -  sptr->id::~id(); // okay
>> -  wptr->id::~id(); // okay
>> -}
>> -
>> -void test_delete(__strong id *sptr, __weak id *wptr) {
>> -  delete sptr;
>> -  delete wptr;
>> -  delete [] sptr; // expected-warning{{destroying an array of '__strong id'; this array must not have been allocated from non-ARC code}}
>> -  delete [] wptr; // expected-warning{{destroying an array of '__weak id'; this array must not have been allocated from non-ARC code}}
>> -}
>> -
>> -void test_new(int n) {
>> -  (void)new strong_id;
>> -  (void)new weak_id;
>> -  (void)new strong_id [n]; // expected-warning{{allocating an array of 'strong_id' (aka '__strong id'); this array must not be deleted in non-ARC code}}
>> -  (void)new weak_id [n]; // expected-warning{{allocating an array of 'weak_id' (aka '__weak id'); this array must not be deleted in non-ARC code}}
>> -
>> -  (void)new __strong id;
>> -  (void)new __weak id;
>> -  (void)new __strong id [n]; // expected-warning{{allocating an array of '__strong id'; this array must not be deleted in non-ARC code}}
>> -
>> -  // Infer '__strong'.
>> -  __strong id *idptr = new id;
>> -  __strong id *idptr2 = new id [n]; // expected-warning{{allocating an array of '__strong id'; this array must not be deleted in non-ARC code}}
>> -
>> -  // ... but not for arrays.
>> -  typedef id id_array[2][3];
>> -  (void)new id_array; // expected-error{{'new' cannot allocate an array of 'id' with no explicit ownership}}
>> -
>> -  typedef __strong id strong_id_array[2][3];
>> -  typedef __strong id strong_id_3[3];
>> -  strong_id_3 *idptr3 = new strong_id_array; // expected-warning{{allocating an array of '__strong id'; this array must not be deleted in non-ARC code}}
>> -}
>> -
>> -void test_jump_scope() {
>> -  goto done; // expected-error{{goto into protected scope}}
>> -  __strong id x; // expected-note{{jump bypasses initialization of retaining variable}}
>> - done:
>> -  return;
>> -}
>> 
>> 
>> _______________________________________________
>> cfe-commits mailing list
>> cfe-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

-- Jean-Daniel








More information about the cfe-commits mailing list