There is an attribute: __attribute__((objc_root_class))
Put it on your root class. On Jul 31, 2012, at 11:21 AM, Nico Weber <[email protected]> wrote: > What's the recommended way to change code that intentionally doesn't > use a superclass? #pragma clang diagnostic? > > (We have this guy in chromium: > > // Deallocated objects are re-classed as |CrZombie|. No superclass > // because then the class would have to override many/most of the > // inherited methods (|NSObject| is like a category magnet!). > @interface CrZombie { > Class isa; > } > @end > ) > > On Wed, Jul 25, 2012 at 12:26 AM, Ted Kremenek <[email protected]> wrote: >> Author: kremenek >> Date: Wed Jul 25 02:26:32 2012 >> New Revision: 160707 >> >> URL: http://llvm.org/viewvc/llvm-project?rev=160707&view=rev >> Log: >> Turn -Wobjc-root-class on by default. <rdar://problem/11203649>. >> >> Modified: >> cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td >> cfe/trunk/test/Analysis/delegates.m >> cfe/trunk/test/PCH/objc_methods.m >> cfe/trunk/test/Sema/warn-documentation.m >> cfe/trunk/test/Sema/warn-self-assign-field.mm >> cfe/trunk/test/SemaObjC/error-implicit-property.m >> cfe/trunk/test/SemaObjC/iboutlet.m >> cfe/trunk/test/SemaObjC/no-ivar-in-interface-block.m >> cfe/trunk/test/SemaObjC/property-12.m >> cfe/trunk/test/SemaObjC/weak-receiver-warn.m >> >> Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td >> URL: >> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=160707&r1=160706&r2=160707&view=diff >> ============================================================================== >> --- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original) >> +++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Wed Jul 25 02:26:32 >> 2012 >> @@ -480,7 +480,7 @@ >> "objc_root_class attribute may only be specified on a root class >> declaration">; >> def warn_objc_root_class_missing : Warning< >> "class %0 defined without specifying a base class">, >> - InGroup<ObjCRootClass>, DefaultIgnore; >> + InGroup<ObjCRootClass>; >> def note_objc_needs_superclass : Note< >> "add a super class to fix this problem">; >> def warn_dup_category_def : Warning< >> >> Modified: cfe/trunk/test/Analysis/delegates.m >> URL: >> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/delegates.m?rev=160707&r1=160706&r2=160707&view=diff >> ============================================================================== >> --- cfe/trunk/test/Analysis/delegates.m (original) >> +++ cfe/trunk/test/Analysis/delegates.m Wed Jul 25 02:26:32 2012 >> @@ -1,4 +1,4 @@ >> -// RUN: %clang_cc1 -analyze -analyzer-checker=core,osx.cocoa.RetainCount >> -analyzer-store=region -verify %s >> +// RUN: %clang_cc1 -analyze -analyzer-checker=core,osx.cocoa.RetainCount >> -analyzer-store=region -Wno-objc-root-class -verify %s >> >> >> //===----------------------------------------------------------------------===// >> >> Modified: cfe/trunk/test/PCH/objc_methods.m >> URL: >> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/PCH/objc_methods.m?rev=160707&r1=160706&r2=160707&view=diff >> ============================================================================== >> --- cfe/trunk/test/PCH/objc_methods.m (original) >> +++ cfe/trunk/test/PCH/objc_methods.m Wed Jul 25 02:26:32 2012 >> @@ -1,5 +1,5 @@ >> // Test this without pch. >> -// RUN: %clang_cc1 -include %S/objc_methods.h -fsyntax-only -verify %s >> +// RUN: %clang_cc1 -include %S/objc_methods.h -fsyntax-only >> -Wno-objc-root-class -verify %s >> >> // Test with pch. >> // RUN: %clang_cc1 -x objective-c -emit-pch -o %t %S/objc_methods.h >> >> Modified: cfe/trunk/test/Sema/warn-documentation.m >> URL: >> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/warn-documentation.m?rev=160707&r1=160706&r2=160707&view=diff >> ============================================================================== >> --- cfe/trunk/test/Sema/warn-documentation.m (original) >> +++ cfe/trunk/test/Sema/warn-documentation.m Wed Jul 25 02:26:32 2012 >> @@ -1,4 +1,4 @@ >> -// RUN: %clang_cc1 -fsyntax-only -Wdocumentation -Wdocumentation-pedantic >> -verify %s >> +// RUN: %clang_cc1 -fsyntax-only -Wno-objc-root-class -Wdocumentation >> -Wdocumentation-pedantic -verify %s >> >> @class NSString; >> >> >> Modified: cfe/trunk/test/Sema/warn-self-assign-field.mm >> URL: >> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/warn-self-assign-field.mm?rev=160707&r1=160706&r2=160707&view=diff >> ============================================================================== >> --- cfe/trunk/test/Sema/warn-self-assign-field.mm (original) >> +++ cfe/trunk/test/Sema/warn-self-assign-field.mm Wed Jul 25 02:26:32 2012 >> @@ -1,4 +1,4 @@ >> -// RUN: %clang_cc1 -fsyntax-only -verify %s >> +// RUN: %clang_cc1 -fsyntax-only -Wno-objc-root-class -verify %s >> >> class S { >> public: >> >> Modified: cfe/trunk/test/SemaObjC/error-implicit-property.m >> URL: >> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/error-implicit-property.m?rev=160707&r1=160706&r2=160707&view=diff >> ============================================================================== >> --- cfe/trunk/test/SemaObjC/error-implicit-property.m (original) >> +++ cfe/trunk/test/SemaObjC/error-implicit-property.m Wed Jul 25 02:26:32 >> 2012 >> @@ -1,4 +1,4 @@ >> -// RUN: %clang_cc1 -verify %s >> +// RUN: %clang_cc1 -Wno-objc-root-class -verify %s >> // rdar://11273060 >> >> @interface I >> >> Modified: cfe/trunk/test/SemaObjC/iboutlet.m >> URL: >> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/iboutlet.m?rev=160707&r1=160706&r2=160707&view=diff >> ============================================================================== >> --- cfe/trunk/test/SemaObjC/iboutlet.m (original) >> +++ cfe/trunk/test/SemaObjC/iboutlet.m Wed Jul 25 02:26:32 2012 >> @@ -1,5 +1,5 @@ >> -// RUN: %clang_cc1 -fsyntax-only -fobjc-default-synthesize-properties >> -verify %s >> -// RUN: %clang_cc1 -x objective-c++ -fsyntax-only >> -fobjc-default-synthesize-properties -verify %s >> +// RUN: %clang_cc1 -fsyntax-only -fobjc-default-synthesize-properties >> -Wno-objc-root-class -verify %s >> +// RUN: %clang_cc1 -x objective-c++ -fsyntax-only >> -fobjc-default-synthesize-properties -Wno-objc-root-class -verify %s >> // rdar://11448209 >> >> #define READONLY readonly >> >> Modified: cfe/trunk/test/SemaObjC/no-ivar-in-interface-block.m >> URL: >> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/no-ivar-in-interface-block.m?rev=160707&r1=160706&r2=160707&view=diff >> ============================================================================== >> --- cfe/trunk/test/SemaObjC/no-ivar-in-interface-block.m (original) >> +++ cfe/trunk/test/SemaObjC/no-ivar-in-interface-block.m Wed Jul 25 02:26:32 >> 2012 >> @@ -1,4 +1,4 @@ >> -// RUN: %clang_cc1 -fsyntax-only -verify -Wobjc-interface-ivars %s >> +// RUN: %clang_cc1 -fsyntax-only -verify -Wno-objc-root-class >> -Wobjc-interface-ivars %s >> // rdar://10763173 >> >> @interface I >> >> Modified: cfe/trunk/test/SemaObjC/property-12.m >> URL: >> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/property-12.m?rev=160707&r1=160706&r2=160707&view=diff >> ============================================================================== >> --- cfe/trunk/test/SemaObjC/property-12.m (original) >> +++ cfe/trunk/test/SemaObjC/property-12.m Wed Jul 25 02:26:32 2012 >> @@ -1,4 +1,4 @@ >> -// RUN: %clang_cc1 -fsyntax-only -Wreadonly-setter-attrs -verify %s >> +// RUN: %clang_cc1 -fsyntax-only -Wno-objc-root-class >> -Wreadonly-setter-attrs -verify %s >> >> @protocol P0 >> @property(readonly,assign) id X; // expected-warning {{property attributes >> 'readonly' and 'assign' are mutually exclusive}} >> >> Modified: cfe/trunk/test/SemaObjC/weak-receiver-warn.m >> URL: >> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/weak-receiver-warn.m?rev=160707&r1=160706&r2=160707&view=diff >> ============================================================================== >> --- cfe/trunk/test/SemaObjC/weak-receiver-warn.m (original) >> +++ cfe/trunk/test/SemaObjC/weak-receiver-warn.m Wed Jul 25 02:26:32 2012 >> @@ -1,4 +1,4 @@ >> -// RUN: %clang_cc1 -fsyntax-only -fobjc-runtime-has-weak -fobjc-arc >> -fblocks -Wreceiver-is-weak -verify %s >> +// RUN: %clang_cc1 -fsyntax-only -fobjc-runtime-has-weak -fobjc-arc >> -fblocks -Wno-objc-root-class -Wreceiver-is-weak -verify %s >> // rdar://10225276 >> >> @interface Test0 >> >> >> _______________________________________________ >> cfe-commits mailing list >> [email protected] >> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits _______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
