diff options
author | Patrick Beard <pcbeard@mac.com> | 2012-04-06 18:12:22 +0000 |
---|---|---|
committer | Patrick Beard <pcbeard@mac.com> | 2012-04-06 18:12:22 +0000 |
commit | b2f6820773aabff3c5c9e0dbb1cbbbda0d80c41f (patch) | |
tree | 69f8b2976891ffc83299227be23f82c42bc1ac97 /include | |
parent | aba3f0f8658b099fabd17f29f67bf6dd8ee5ddfd (diff) |
Added a new attribute, objc_root_class, which informs the compiler when a root class is intentionally declared.
The warning this inhibits, -Wobjc-root-class, is opt-in for now. However, all clang unit tests that would trigger
the warning have been updated to use -Wno-objc-root-class. <rdar://problem/7446698>
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154187 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r-- | include/clang/AST/NSAPI.h | 3 | ||||
-rw-r--r-- | include/clang/Basic/Attr.td | 7 | ||||
-rw-r--r-- | include/clang/Basic/DiagnosticGroups.td | 1 | ||||
-rw-r--r-- | include/clang/Basic/DiagnosticSemaKinds.td | 7 |
4 files changed, 17 insertions, 1 deletions
diff --git a/include/clang/AST/NSAPI.h b/include/clang/AST/NSAPI.h index 222c8dbacc..40e9759067 100644 --- a/include/clang/AST/NSAPI.h +++ b/include/clang/AST/NSAPI.h @@ -25,6 +25,7 @@ public: ASTContext &getASTContext() const { return Ctx; } enum NSClassIdKindKind { + ClassId_NSObject, ClassId_NSString, ClassId_NSArray, ClassId_NSMutableArray, @@ -32,7 +33,7 @@ public: ClassId_NSMutableDictionary, ClassId_NSNumber }; - static const unsigned NumClassIds = 6; + static const unsigned NumClassIds = 7; enum NSStringMethodKind { NSStr_stringWithString, diff --git a/include/clang/Basic/Attr.td b/include/clang/Basic/Attr.td index ee9f60f252..e8e0f35096 100644 --- a/include/clang/Basic/Attr.td +++ b/include/clang/Basic/Attr.td @@ -452,6 +452,11 @@ def ObjCReturnsInnerPointer : Attr { let Subjects = [ObjCMethod]; } +def ObjCRootClass : Attr { + let Spellings = ["objc_root_class"]; + let Subjects = [ObjCInterface]; +} + def Overloadable : Attr { let Spellings = ["overloadable"]; } @@ -534,10 +539,12 @@ def Unavailable : InheritableAttr { def ArcWeakrefUnavailable : InheritableAttr { let Spellings = ["objc_arc_weak_reference_unavailable"]; + let Subjects = [ObjCInterface]; } def ObjCRequiresPropertyDefs : InheritableAttr { let Spellings = ["objc_requires_property_definitions"]; + let Subjects = [ObjCInterface]; } def Unused : InheritableAttr { diff --git a/include/clang/Basic/DiagnosticGroups.td b/include/clang/Basic/DiagnosticGroups.td index 2e91a5ffa8..c83985345b 100644 --- a/include/clang/Basic/DiagnosticGroups.td +++ b/include/clang/Basic/DiagnosticGroups.td @@ -148,6 +148,7 @@ def ObjCPropertyImpl : DiagGroup<"objc-property-implementation">; def ObjCMissingSuperCalls : DiagGroup<"objc-missing-super-calls">; def ObjCRetainBlockProperty : DiagGroup<"objc-noncopy-retain-block-property">; def ObjCReadonlyPropertyHasSetter : DiagGroup<"objc-readonly-with-setter-property">; +def ObjCRootClass : DiagGroup<"objc-root-class">; def Packed : DiagGroup<"packed">; def Padded : DiagGroup<"padded">; def PointerArith : DiagGroup<"pointer-arith">; diff --git a/include/clang/Basic/DiagnosticSemaKinds.td b/include/clang/Basic/DiagnosticSemaKinds.td index 30173fb7ba..515919c4fe 100644 --- a/include/clang/Basic/DiagnosticSemaKinds.td +++ b/include/clang/Basic/DiagnosticSemaKinds.td @@ -444,6 +444,13 @@ def note_receiver_is_id : Note< "receiver is treated with 'id' type for purpose of method lookup">; def note_suppressed_class_declare : Note< "class with specified objc_requires_property_definitions attribute is declared here">; +def err_objc_root_class_subclass : Error< + "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; +def note_objc_needs_superclass : Note< + "add a super class to fix this problem">; def warn_dup_category_def : Warning< "duplicate definition of category %1 on interface %0">; def err_conflicting_super_class : Error<"conflicting super class name %0">; |