Permalink
Browse files

Added a new attribute, objc_root_class, which informs the compiler wh…

…en 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
  • Loading branch information...
pcbeard committed Apr 6, 2012
1 parent aba3f0f commit b2f6820773aabff3c5c9e0dbb1cbbbda0d80c41f
Showing with 329 additions and 246 deletions.
  1. +2 −1 include/clang/AST/NSAPI.h
  2. +7 −0 include/clang/Basic/Attr.td
  3. +1 −0 include/clang/Basic/DiagnosticGroups.td
  4. +7 −0 include/clang/Basic/DiagnosticSemaKinds.td
  5. +1 −0 lib/AST/NSAPI.cpp
  6. +1 −0 lib/Parse/ParseObjc.cpp
  7. +19 −0 lib/Sema/SemaDeclAttr.cpp
  8. +30 −1 lib/Sema/SemaDeclObjC.cpp
  9. +2 −2 test/Analysis/CheckNSError.m
  10. +2 −2 test/Analysis/NSPanel.m
  11. +4 −4 test/Analysis/NSString.m
  12. +2 −2 test/Analysis/ObjCProperties.m
  13. +1 −1 test/Analysis/ObjCRetSigs.m
  14. +1 −1 test/Analysis/dead-stores.m
  15. +1 −1 test/Analysis/malloc.m
  16. +2 −2 test/Analysis/misc-ps-region-store.m
  17. +4 −4 test/Analysis/misc-ps.m
  18. +1 −1 test/Analysis/nil-receiver-undefined-larger-than-voidptr-ret-region.m
  19. +3 −3 test/Analysis/nil-receiver-undefined-larger-than-voidptr-ret.m
  20. +1 −1 test/Analysis/pr_2542_rdar_6793404.m
  21. +1 −1 test/Analysis/properties.m
  22. +1 −1 test/Analysis/rdar-6600344-nil-receiver-undefined-struct-ret.m
  23. +1 −1 test/Analysis/retain-release-gc-only.m
  24. +2 −2 test/Analysis/retain-release.m
  25. +1 −1 test/Analysis/unused-ivars.m
  26. +4 −4 test/FixIt/fixit-missing-method-return-type.m
  27. +3 −3 test/FixIt/typo.m
  28. +2 −2 test/Modules/redecl-merge.m
  29. +2 −2 test/PCH/chain-categories2.m
  30. +4 −4 test/PCH/chain-selectors.m
  31. +3 −3 test/PCH/method_pool.m
  32. +1 −1 test/Parser/missing-end-4.m
  33. +1 −1 test/Parser/objc-forcollection-neg-2.m
  34. +1 −1 test/Parser/objc-forcollection-neg.m
  35. +1 −1 test/Parser/objc-foreach-syntax.m
  36. +2 −2 test/Parser/objc-init.m
  37. +1 −1 test/Parser/objc-property-syntax.m
  38. +1 −1 test/Parser/objc-synthesized-recover.m
  39. +2 −2 test/SemaObjC/ClassPropertyNotObject.m
  40. +1 −1 test/SemaObjC/ContClassPropertyLookup.m
  41. +1 −1 test/SemaObjC/DoubleMethod.m
  42. +1 −1 test/SemaObjC/alias-test-2.m
  43. +1 −1 test/SemaObjC/arc-decls.m
  44. +1 −1 test/SemaObjC/arc-jump-block.m
  45. +1 −1 test/SemaObjC/arc-no-runtime.m
  46. +2 −2 test/SemaObjC/arc-objc-lifetime.m
  47. +1 −1 test/SemaObjC/arc-property-lifetime.m
  48. +1 −1 test/SemaObjC/arc-property.m
  49. +2 −2 test/SemaObjC/arc-readonly-property-ivar-1.m
  50. +1 −1 test/SemaObjC/arc-readonly-property-ivar.m
  51. +1 −1 test/SemaObjC/arc-retain-block-property.m
  52. +1 −1 test/SemaObjC/arc-setter-property-match.m
  53. +1 −1 test/SemaObjC/arc-unavailable-for-weakref.m
  54. +1 −1 test/SemaObjC/arc-unsafe-assigns.m
  55. +1 −1 test/SemaObjC/arc.m
  56. +2 −2 test/SemaObjC/assign-rvalue-message.m
  57. +1 −1 test/SemaObjC/atomoic-property-synnthesis-rules.m
  58. +1 −1 test/SemaObjC/attr-deprecated.m
  59. +16 −0 test/SemaObjC/attr-root-class.m
  60. +1 −1 test/SemaObjC/autoreleasepool.m
  61. +1 −1 test/SemaObjC/bad-property-synthesis-crash.m
  62. +2 −2 test/SemaObjC/block-on-method-param.m
  63. +1 −1 test/SemaObjC/block-type-safety.m
  64. +1 −1 test/SemaObjC/category-1.m
  65. +1 −1 test/SemaObjC/category-method-lookup.m
  66. +1 −1 test/SemaObjC/check-dup-objc-decls-1.m
  67. +1 −1 test/SemaObjC/class-extension-after-implementation.m
  68. +1 −1 test/SemaObjC/class-getter-using-dotsyntax.m
  69. +1 −1 test/SemaObjC/class-impl-1.m
  70. +1 −1 test/SemaObjC/class-message-protocol-lookup.m
  71. +1 −1 test/SemaObjC/class-method-self.m
  72. +1 −1 test/SemaObjC/class-protocol-method-match.m
  73. +1 −1 test/SemaObjC/compatible-protocol-qualified-types.m
  74. +1 −1 test/SemaObjC/comptypes-10.m
  75. +1 −1 test/SemaObjC/comptypes-a.m
  76. +1 −1 test/SemaObjC/conditional-expr-5.m
  77. +1 −1 test/SemaObjC/conditional-expr.m
  78. +1 −1 test/SemaObjC/conflict-nonfragile-abi2.m
  79. +1 −1 test/SemaObjC/conflicting-ivar-test-1.m
  80. +1 −1 test/SemaObjC/continuation-class-err.m
  81. +1 −1 test/SemaObjC/custom-atomic-property.m
  82. +1 −1 test/SemaObjC/default-synthesize-1.m
  83. +2 −2 test/SemaObjC/default-synthesize-2.m
  84. +2 −2 test/SemaObjC/default-synthesize-3.m
  85. +1 −1 test/SemaObjC/default-synthesize.m
  86. +1 −1 test/SemaObjC/deref-interface.m
  87. +1 −1 test/SemaObjC/direct-synthesized-ivar-access.m
  88. +1 −1 test/SemaObjC/dist-object-modifiers.m
  89. +1 −1 test/SemaObjC/enhanced-proto-2.m
  90. +2 −2 test/SemaObjC/err-ivar-access-in-class-method.m
  91. +2 −2 test/SemaObjC/error-property-gc-attr.m
  92. +1 −1 test/SemaObjC/format-strings-objc.m
  93. +1 −1 test/SemaObjC/forward-class-1.m
  94. +1 −1 test/SemaObjC/gcc-cast-ext.m
  95. +1 −1 test/SemaObjC/ibaction.m
  96. +1 −1 test/SemaObjC/idiomatic-parentheses.m
  97. +1 −1 test/SemaObjC/incomplete-implementation.m
  98. +1 −1 test/SemaObjC/interface-scope-2.m
  99. +1 −1 test/SemaObjC/invalid-code.m
  100. +1 −1 test/SemaObjC/ivar-access-tests.m
  101. +1 −1 test/SemaObjC/ivar-in-class-extension.m
  102. +1 −1 test/SemaObjC/ivar-in-implementations.m
  103. +1 −1 test/SemaObjC/ivar-lookup-resolution-builtin.m
  104. +1 −1 test/SemaObjC/ivar-lookup.m
  105. +1 −1 test/SemaObjC/ivar-ref-misuse.m
  106. +1 −1 test/SemaObjC/legacy-implementation-1.m
  107. +1 −1 test/SemaObjC/message.m
  108. +1 −1 test/SemaObjC/method-attributes.m
  109. +1 −1 test/SemaObjC/method-bad-param.m
  110. +1 −1 test/SemaObjC/method-conflict-1.m
  111. +1 −1 test/SemaObjC/method-conflict-2.m
  112. +1 −1 test/SemaObjC/method-conflict.m
  113. +1 −1 test/SemaObjC/method-def-1.m
  114. +1 −1 test/SemaObjC/method-lookup.m
  115. +1 −1 test/SemaObjC/method-prototype-scope.m
  116. +1 −1 test/SemaObjC/method-typecheck-1.m
  117. +1 −1 test/SemaObjC/method-undef-extension-warn-1.m
  118. +1 −1 test/SemaObjC/method-undefined-warn-1.m
  119. +1 −1 test/SemaObjC/method-unused-attribute.m
  120. +1 −1 test/SemaObjC/missing-atend-metadata.m
  121. +1 −1 test/SemaObjC/missing-method-return-type.m
  122. +2 −2 test/SemaObjC/nested-typedef-decl.m
  123. +1 −1 test/SemaObjC/newproperty-class-method-1.m
  124. +1 −1 test/SemaObjC/no-gc-weak-test.m
  125. +2 −2 test/SemaObjC/no-ivar-access-control.m
  126. +1 −1 test/SemaObjC/no-protocol-option-tests.m
  127. +1 −1 test/SemaObjC/no-warn-qual-mismatch.m
  128. +1 −1 test/SemaObjC/no-warn-synth-protocol-meth.m
  129. +1 −1 test/SemaObjC/no-warning-unavail-unimp.m
  130. +1 −1 test/SemaObjC/nonnull.m
  131. +1 −1 test/SemaObjC/nsobject-attribute-1.m
  132. +1 −1 test/SemaObjC/nsobject-attribute.m
  133. +1 −1 test/SemaObjC/objc-buffered-methods.m
  134. +1 −1 test/SemaObjC/objc-cstyle-args-in-methods.m
  135. +1 −1 test/SemaObjC/objc-qualified-property-lookup.m
  136. +1 −1 test/SemaObjC/pedantic-dynamic-test.m
  137. +1 −1 test/SemaObjC/pragma-pack.m
  138. +1 −1 test/SemaObjC/property-2.m
  139. +1 −1 test/SemaObjC/property-9.m
  140. +1 −1 test/SemaObjC/property-and-ivar-use.m
  141. +1 −1 test/SemaObjC/property-category-1.m
  142. +1 −1 test/SemaObjC/property-category-3.m
  143. +1 −1 test/SemaObjC/property-category-4.m
  144. +1 −1 test/SemaObjC/property-category-impl.m
  145. +2 −2 test/SemaObjC/property-dot-receiver.m
  146. +1 −1 test/SemaObjC/property-expression-error.m
  147. +1 −1 test/SemaObjC/property-impl-misuse.m
  148. +1 −1 test/SemaObjC/property-in-class-extension.m
  149. +1 −1 test/SemaObjC/property-ivar-mismatch.m
  150. +1 −1 test/SemaObjC/property-lookup-in-id.m
  151. +1 −1 test/SemaObjC/property-method-lookup-impl.m
  152. +1 −1 test/SemaObjC/property-not-lvalue.m
  153. +1 −1 test/SemaObjC/property-ns-returns-not-retained-attr.m
  154. +1 −1 test/SemaObjC/property-redundant-decl-accessor.m
  155. +1 −1 test/SemaObjC/property-typecheck-1.m
  156. +1 −1 test/SemaObjC/property-user-setter.m
  157. +1 −1 test/SemaObjC/property.m
  158. +1 −1 test/SemaObjC/protocol-archane.m
  159. +1 −1 test/SemaObjC/protocol-id-test-1.m
  160. +1 −1 test/SemaObjC/protocol-id-test-2.m
  161. +1 −1 test/SemaObjC/provisional-ivar-lookup.m
  162. +1 −1 test/SemaObjC/qualified-protocol-method-conflicts.m
  163. +1 −1 test/SemaObjC/related-result-type-inference.m
  164. +1 −1 test/SemaObjC/return.m
  165. +1 −1 test/SemaObjC/scope-check.m
  166. +1 −1 test/SemaObjC/selector-3.m
  167. +1 −1 test/SemaObjC/selector-error.m
  168. +1 −1 test/SemaObjC/self-assign.m
  169. +2 −2 test/SemaObjC/self-declared-in-block.m
  170. +1 −1 test/SemaObjC/severe-syntax-error.m
  171. +1 −1 test/SemaObjC/sizeof-interface.m
  172. +1 −1 test/SemaObjC/stand-alone-implementation.m
  173. +1 −1 test/SemaObjC/synchronized.m
  174. +1 −1 test/SemaObjC/synth-provisional-ivars-1.m
  175. +1 −1 test/SemaObjC/synth-provisional-ivars.m
  176. +1 −1 test/SemaObjC/synthesize-setter-contclass.m
  177. +1 −1 test/SemaObjC/synthesized-ivar.m
  178. +1 −1 test/SemaObjC/transparent-union.m
  179. +1 −1 test/SemaObjC/undeclared-selector.m
  180. +1 −1 test/SemaObjC/undef-protocol-methods-1.m
  181. +1 −1 test/SemaObjC/undef-superclass-1.m
  182. +1 −1 test/SemaObjC/unimplemented-protocol-prop.m
  183. +1 −1 test/SemaObjC/unused.m
  184. +1 −1 test/SemaObjC/warn-deprecated-implementations.m
  185. +1 −1 test/SemaObjC/warn-forward-class-attr-deprecated.m
  186. +1 −1 test/SemaObjC/warn-implicit-atomic-property.m
  187. +6 −5 test/SemaObjC/warn-missing-super.m
  188. +1 −1 test/SemaObjC/warn-retain-cycle.m
  189. +2 −2 test/SemaObjC/warn-weak-field.m
  190. +1 −1 test/SemaObjC/weak-property.m
  191. +1 −1 test/SemaObjCXX/arc-overloading.mm
  192. +1 −1 test/SemaObjCXX/blocks.mm
  193. +1 −1 test/SemaObjCXX/composite-objc-pointertype.mm
  194. +1 −1 test/SemaObjCXX/cstyle-block-pointer-cast.mm
  195. +1 −1 test/SemaObjCXX/cxxoperator-selector.mm
  196. +1 −1 test/SemaObjCXX/fragile-abi-object-assign.m
  197. +1 −1 test/SemaObjCXX/goto.mm
  198. +1 −1 test/SemaObjCXX/instantiate-method-return.mm
  199. +1 −1 test/SemaObjCXX/ivar-construct.mm
  200. +1 −1 test/SemaObjCXX/ivar-lookup.mm
  201. +1 −1 test/SemaObjCXX/message.mm
  202. +1 −1 test/SemaObjCXX/objc-decls-inside-namespace.mm
  203. +1 −1 test/SemaObjCXX/objc-pointer-conv.mm
  204. +1 −1 test/SemaObjCXX/overload.mm
  205. +1 −1 test/SemaObjCXX/propert-dot-error.mm
  206. +1 −1 test/SemaObjCXX/properties.mm
  207. +1 −1 test/SemaObjCXX/property-reference.mm
  208. +1 −1 test/SemaObjCXX/property-synthesis-error.mm
  209. +1 −1 test/SemaObjCXX/void_to_obj.mm
@@ -25,14 +25,15 @@ class NSAPI {
ASTContext &getASTContext() const { return Ctx; }
enum NSClassIdKindKind {
+ ClassId_NSObject,
ClassId_NSString,
ClassId_NSArray,
ClassId_NSMutableArray,
ClassId_NSDictionary,
ClassId_NSMutableDictionary,
ClassId_NSNumber
};
- static const unsigned NumClassIds = 6;
+ static const unsigned NumClassIds = 7;
enum NSStringMethodKind {
NSStr_stringWithString,
@@ -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 {
@@ -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">;
@@ -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">;
View
@@ -18,6 +18,7 @@ NSAPI::NSAPI(ASTContext &ctx)
IdentifierInfo *NSAPI::getNSClassId(NSClassIdKindKind K) const {
static const char *ClassName[NumClassIds] = {
+ "NSObject",
"NSString",
"NSArray",
"NSMutableArray",
View
@@ -161,6 +161,7 @@ void Parser::CheckNestedObjCContexts(SourceLocation AtLoc)
/// __attribute__((deprecated))
/// __attribute__((unavailable))
/// __attribute__((objc_exception)) - used by NSException on 64-bit
+/// __attribute__((objc_root_class))
///
Decl *Parser::ParseObjCAtInterfaceDeclaration(SourceLocation AtLoc,
ParsedAttributes &attrs) {
View
@@ -1593,6 +1593,22 @@ static void handleArcWeakrefUnavailableAttr(Sema &S, Decl *D,
Attr.getRange(), S.Context));
}
+static void handleObjCRootClassAttr(Sema &S, Decl *D,
+ const AttributeList &Attr) {
+ if (!isa<ObjCInterfaceDecl>(D)) {
+ S.Diag(Attr.getLoc(), diag::err_attribute_requires_objc_interface);
+ return;
+ }
+
+ unsigned NumArgs = Attr.getNumArgs();
+ if (NumArgs > 0) {
+ S.Diag(Attr.getLoc(), diag::err_attribute_too_many_arguments) << 0;
+ return;
+ }
+
+ D->addAttr(::new (S.Context) ObjCRootClassAttr(Attr.getRange(), S.Context));
+}
+
static void handleObjCRequiresPropertyDefsAttr(Sema &S, Decl *D,
const AttributeList &Attr) {
if (!isa<ObjCInterfaceDecl>(D)) {
@@ -3658,6 +3674,9 @@ static void ProcessInheritableDeclAttr(Sema &S, Scope *scope, Decl *D,
case AttributeList::AT_objc_arc_weak_reference_unavailable:
handleArcWeakrefUnavailableAttr (S, D, Attr);
break;
+ case AttributeList::AT_objc_root_class:
+ handleObjCRootClassAttr(S, D, Attr);
+ break;
case AttributeList::AT_objc_requires_property_definitions:
handleObjCRequiresPropertyDefsAttr (S, D, Attr);
break;
View
@@ -24,6 +24,7 @@
#include "clang/AST/ASTMutationListener.h"
#include "clang/Basic/SourceManager.h"
#include "clang/Sema/DeclSpec.h"
+#include "clang/Lex/Preprocessor.h"
#include "llvm/ADT/DenseSet.h"
using namespace clang;
@@ -2371,11 +2372,39 @@ Decl *Sema::ActOnAtEnd(Scope *S, SourceRange AtEnd,
AtomicPropertySetterGetterRules(IC, IDecl);
DiagnoseOwningPropertyGetterSynthesis(IC);
- if (LangOpts.ObjCNonFragileABI2)
+ bool HasRootClassAttr = IDecl->hasAttr<ObjCRootClassAttr>();
+ if (IDecl->getSuperClass() == NULL) {
+ // This class has no superclass, so check that it has been marked with
+ // __attribute((objc_root_class)).
+ if (!HasRootClassAttr) {
+ SourceLocation DeclLoc(IDecl->getLocation());
+ SourceLocation SuperClassLoc(PP.getLocForEndOfToken(DeclLoc));
+ Diag(DeclLoc, diag::warn_objc_root_class_missing)
+ << IDecl->getIdentifier();
+ // See if NSObject is in the current scope, and if it is, suggest
+ // adding " : NSObject " to the class declaration.
+ NamedDecl *IF = LookupSingleName(TUScope,
+ NSAPIObj->getNSClassId(NSAPI::ClassId_NSObject),
+ DeclLoc, LookupOrdinaryName);
+ ObjCInterfaceDecl *NSObjectDecl = dyn_cast_or_null<ObjCInterfaceDecl>(IF);
+ if (NSObjectDecl && NSObjectDecl->getDefinition()) {
+ Diag(SuperClassLoc, diag::note_objc_needs_superclass)
+ << FixItHint::CreateInsertion(SuperClassLoc, " : NSObject ");
+ } else {
+ Diag(SuperClassLoc, diag::note_objc_needs_superclass);
+ }
+ }
+ } else if (HasRootClassAttr) {
+ // Complain that only root classes may have this attribute.
+ Diag(IDecl->getLocation(), diag::err_objc_root_class_subclass);
+ }
+
+ if (LangOpts.ObjCNonFragileABI2) {
while (IDecl->getSuperClass()) {
DiagnoseDuplicateIvars(IDecl, IDecl->getSuperClass());
IDecl = IDecl->getSuperClass();
}
+ }
}
SetIvarInitializers(IC);
} else if (ObjCCategoryImplDecl* CatImplClass =
@@ -1,5 +1,5 @@
-// RUN: %clang_cc1 -analyze -analyzer-checker=core,osx.cocoa.NSError,osx.coreFoundation.CFError -analyzer-store=region -analyzer-constraints=basic -verify %s
-// RUN: %clang_cc1 -analyze -analyzer-checker=core,osx.cocoa.NSError,osx.coreFoundation.CFError -analyzer-store=region -analyzer-constraints=range -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-checker=core,osx.cocoa.NSError,osx.coreFoundation.CFError -analyzer-store=region -analyzer-constraints=basic -verify -Wno-objc-root-class %s
+// RUN: %clang_cc1 -analyze -analyzer-checker=core,osx.cocoa.NSError,osx.coreFoundation.CFError -analyzer-store=region -analyzer-constraints=range -verify -Wno-objc-root-class %s
typedef signed char BOOL;
View
@@ -1,5 +1,5 @@
-// RUN: %clang_cc1 -analyze -analyzer-checker=core,osx.cocoa.RetainCount,experimental.core -analyzer-store=region -analyzer-constraints=basic -verify %s
-// RUN: %clang_cc1 -analyze -analyzer-checker=core,osx.cocoa.RetainCount,experimental.core -analyzer-store=region -analyzer-constraints=range -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-checker=core,osx.cocoa.RetainCount,experimental.core -analyzer-store=region -analyzer-constraints=basic -verify -Wno-objc-root-class %s
+// RUN: %clang_cc1 -analyze -analyzer-checker=core,osx.cocoa.RetainCount,experimental.core -analyzer-store=region -analyzer-constraints=range -verify -Wno-objc-root-class %s
// BEGIN delta-debugging reduced header stuff
View
@@ -1,7 +1,7 @@
-// RUN: %clang_cc1 -triple i386-apple-darwin10 -analyze -analyzer-checker=core,osx.cocoa.NilArg,osx.cocoa.RetainCount,osx.AtomicCAS,experimental.core -analyzer-store=region -analyzer-constraints=basic -verify %s
-// RUN: %clang_cc1 -triple i386-apple-darwin10 -analyze -analyzer-checker=core,osx.cocoa.NilArg,osx.cocoa.RetainCount,osx.AtomicCAS,experimental.core -analyzer-store=region -analyzer-constraints=range -verify %s
-// RUN: %clang_cc1 -DTEST_64 -triple x86_64-apple-darwin10 -analyze -analyzer-checker=core,osx.cocoa.NilArg,osx.cocoa.RetainCount,osx.AtomicCAS,experimental.core -analyzer-store=region -analyzer-constraints=basic -verify %s
-// RUN: %clang_cc1 -DTEST_64 -triple x86_64-apple-darwin10 -analyze -analyzer-checker=core,osx.cocoa.NilArg,osx.cocoa.RetainCount,osx.AtomicCAS,experimental.core -analyzer-store=region -analyzer-constraints=range -verify %s
+// RUN: %clang_cc1 -triple i386-apple-darwin10 -analyze -analyzer-checker=core,osx.cocoa.NilArg,osx.cocoa.RetainCount,osx.AtomicCAS,experimental.core -analyzer-store=region -analyzer-constraints=basic -verify -Wno-objc-root-class %s
+// RUN: %clang_cc1 -triple i386-apple-darwin10 -analyze -analyzer-checker=core,osx.cocoa.NilArg,osx.cocoa.RetainCount,osx.AtomicCAS,experimental.core -analyzer-store=region -analyzer-constraints=range -verify -Wno-objc-root-class %s
+// RUN: %clang_cc1 -DTEST_64 -triple x86_64-apple-darwin10 -analyze -analyzer-checker=core,osx.cocoa.NilArg,osx.cocoa.RetainCount,osx.AtomicCAS,experimental.core -analyzer-store=region -analyzer-constraints=basic -verify -Wno-objc-root-class %s
+// RUN: %clang_cc1 -DTEST_64 -triple x86_64-apple-darwin10 -analyze -analyzer-checker=core,osx.cocoa.NilArg,osx.cocoa.RetainCount,osx.AtomicCAS,experimental.core -analyzer-store=region -analyzer-constraints=range -verify -Wno-objc-root-class %s
//===----------------------------------------------------------------------===//
@@ -1,5 +1,5 @@
-// RUN: %clang_cc1 -analyze -analyzer-checker=core,experimental.core -analyzer-store=region -analyzer-constraints=basic %s -verify
-// RUN: %clang_cc1 -analyze -analyzer-checker=core,experimental.core -analyzer-store=region -analyzer-constraints=range %s -verify
+// RUN: %clang_cc1 -analyze -analyzer-checker=core,experimental.core -analyzer-store=region -analyzer-constraints=basic -Wno-objc-root-class %s -verify
+// RUN: %clang_cc1 -analyze -analyzer-checker=core,experimental.core -analyzer-store=region -analyzer-constraints=range -Wno-objc-root-class %s -verify
// The point of this test cases is to exercise properties in the static
// analyzer
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -analyze -analyzer-checker=experimental.core -analyzer-checker=osx.cocoa.IncompatibleMethodTypes -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-checker=experimental.core -analyzer-checker=osx.cocoa.IncompatibleMethodTypes -verify -Wno-objc-root-class %s
int printf(const char *, ...);
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -analyze -analyzer-checker=experimental.core -analyzer-checker=deadcode.DeadStores,osx.cocoa.RetainCount -fblocks -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-checker=experimental.core -analyzer-checker=deadcode.DeadStores,osx.cocoa.RetainCount -fblocks -verify -Wno-objc-root-class %s
typedef signed char BOOL;
typedef unsigned int NSUInteger;
View
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -analyze -analyzer-checker=core,unix.Malloc -analyzer-store=region -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-checker=core,unix.Malloc -analyzer-store=region -verify -Wno-objc-root-class %s
#include "system-header-simulator-objc.h"
@class NSString;
@@ -1,5 +1,5 @@
-// RUN: %clang_cc1 -triple i386-apple-darwin9 -analyze -analyzer-checker=core,experimental.deadcode.IdempotentOperations,experimental.core.CastToStruct,experimental.security.ReturnPtrRange,experimental.security.ArrayBound -analyzer-store=region -verify -fblocks -analyzer-opt-analyze-nested-blocks %s
-// RUN: %clang_cc1 -triple x86_64-apple-darwin9 -DTEST_64 -analyze -analyzer-checker=core,experimental.deadcode.IdempotentOperations,experimental.core.CastToStruct,experimental.security.ReturnPtrRange,experimental.security.ArrayBound -analyzer-store=region -verify -fblocks -analyzer-opt-analyze-nested-blocks %s
+// RUN: %clang_cc1 -triple i386-apple-darwin9 -analyze -analyzer-checker=core,experimental.deadcode.IdempotentOperations,experimental.core.CastToStruct,experimental.security.ReturnPtrRange,experimental.security.ArrayBound -analyzer-store=region -verify -fblocks -analyzer-opt-analyze-nested-blocks -Wno-objc-root-class %s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin9 -DTEST_64 -analyze -analyzer-checker=core,experimental.deadcode.IdempotentOperations,experimental.core.CastToStruct,experimental.security.ReturnPtrRange,experimental.security.ArrayBound -analyzer-store=region -verify -fblocks -analyzer-opt-analyze-nested-blocks -Wno-objc-root-class %s
typedef long unsigned int size_t;
void *memcpy(void *, const void *, size_t);
View
@@ -1,8 +1,8 @@
// NOTE: Use '-fobjc-gc' to test the analysis being run twice, and multiple reports are not issued.
-// RUN: %clang_cc1 -triple i386-apple-darwin10 -analyze -analyzer-checker=core,experimental.deadcode.IdempotentOperations,experimental.core,osx.cocoa.AtSync -analyzer-store=region -analyzer-constraints=basic -verify -fblocks -Wno-unreachable-code -Wno-null-dereference %s
-// RUN: %clang_cc1 -triple i386-apple-darwin10 -analyze -analyzer-checker=core,experimental.deadcode.IdempotentOperations,experimental.core,osx.cocoa.AtSync -analyzer-store=region -analyzer-constraints=range -verify -fblocks -Wno-unreachable-code -Wno-null-dereference %s
-// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -analyze -analyzer-checker=core,experimental.deadcode.IdempotentOperations,experimental.core,osx.cocoa.AtSync -analyzer-store=region -analyzer-constraints=basic -verify -fblocks -Wno-unreachable-code -Wno-null-dereference %s
-// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -analyze -analyzer-checker=core,experimental.deadcode.IdempotentOperations,experimental.core,osx.cocoa.AtSync -analyzer-store=region -analyzer-constraints=range -verify -fblocks -Wno-unreachable-code -Wno-null-dereference %s
+// RUN: %clang_cc1 -triple i386-apple-darwin10 -analyze -analyzer-checker=core,experimental.deadcode.IdempotentOperations,experimental.core,osx.cocoa.AtSync -analyzer-store=region -analyzer-constraints=basic -verify -fblocks -Wno-unreachable-code -Wno-null-dereference -Wno-objc-root-class %s
+// RUN: %clang_cc1 -triple i386-apple-darwin10 -analyze -analyzer-checker=core,experimental.deadcode.IdempotentOperations,experimental.core,osx.cocoa.AtSync -analyzer-store=region -analyzer-constraints=range -verify -fblocks -Wno-unreachable-code -Wno-null-dereference -Wno-objc-root-class %s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -analyze -analyzer-checker=core,experimental.deadcode.IdempotentOperations,experimental.core,osx.cocoa.AtSync -analyzer-store=region -analyzer-constraints=basic -verify -fblocks -Wno-unreachable-code -Wno-null-dereference -Wno-objc-root-class %s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -analyze -analyzer-checker=core,experimental.deadcode.IdempotentOperations,experimental.core,osx.cocoa.AtSync -analyzer-store=region -analyzer-constraints=range -verify -fblocks -Wno-unreachable-code -Wno-null-dereference -Wno-objc-root-class %s
#ifndef __clang_analyzer__
#error __clang_analyzer__ not defined
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -triple i386-apple-darwin8 -analyze -analyzer-checker=core,experimental.core -analyzer-constraints=range -analyzer-store=region -verify %s
+// RUN: %clang_cc1 -triple i386-apple-darwin8 -analyze -analyzer-checker=core,experimental.core -analyzer-constraints=range -analyzer-store=region -verify -Wno-objc-root-class %s
// <rdar://problem/6888289> - This test case shows that a nil instance
// variable can possibly be initialized by a method.
@@ -1,6 +1,6 @@
-// RUN: %clang_cc1 -triple i386-apple-darwin8 -analyze -analyzer-checker=core,experimental.core -analyzer-constraints=basic -analyzer-store=region %s 2>&1 | FileCheck -check-prefix=darwin8 %s
-// RUN: %clang_cc1 -triple i386-apple-darwin9 -analyze -analyzer-checker=core,experimental.core -analyzer-constraints=basic -analyzer-store=region %s 2>&1 | FileCheck -check-prefix=darwin9 %s
-// RUN: %clang_cc1 -triple thumbv6-apple-ios4.0 -analyze -analyzer-checker=core,experimental.core -analyzer-constraints=basic -analyzer-store=region %s 2>&1 | FileCheck -check-prefix=darwin9 %s
+// RUN: %clang_cc1 -triple i386-apple-darwin8 -analyze -analyzer-checker=core,experimental.core -analyzer-constraints=basic -analyzer-store=region -Wno-objc-root-class %s 2>&1 | FileCheck -check-prefix=darwin8 %s
+// RUN: %clang_cc1 -triple i386-apple-darwin9 -analyze -analyzer-checker=core,experimental.core -analyzer-constraints=basic -analyzer-store=region -Wno-objc-root-class %s 2>&1 | FileCheck -check-prefix=darwin9 %s
+// RUN: %clang_cc1 -triple thumbv6-apple-ios4.0 -analyze -analyzer-checker=core,experimental.core -analyzer-constraints=basic -analyzer-store=region -Wno-objc-root-class %s 2>&1 | FileCheck -check-prefix=darwin9 %s
@interface MyClass {}
- (void *)voidPtrM;
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -analyze -analyzer-checker=core,osx.cocoa.RetainCount,experimental.core -pedantic -analyzer-store=region -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-checker=core,osx.cocoa.RetainCount,experimental.core -pedantic -analyzer-store=region -verify -Wno-objc-root-class %s
// BEGIN delta-debugging reduced header stuff
@@ -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 -verify -Wno-objc-root-class %s
typedef signed char BOOL;
typedef unsigned int NSUInteger;
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -analyze -analyzer-checker=core,experimental.core -analyzer-constraints=basic -analyzer-store=region %s -verify
+// RUN: %clang_cc1 -analyze -analyzer-checker=core,experimental.core -analyzer-constraints=basic -analyzer-store=region -verify -Wno-objc-root-class %s
typedef struct Foo { int x; } Bar;
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -analyze -analyzer-checker=core,osx.cocoa.RetainCount,osx.cocoa.NSAutoreleasePool -analyzer-store=region -fobjc-gc-only -fblocks -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-checker=core,osx.cocoa.RetainCount,osx.cocoa.NSAutoreleasePool -analyzer-store=region -fobjc-gc-only -fblocks -verify -Wno-objc-root-class %s
//===----------------------------------------------------------------------===//
// Header stuff.
@@ -1,5 +1,5 @@
-// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -analyze -analyzer-checker=core,osx.coreFoundation.CFRetainRelease,osx.cocoa.ClassRelease,osx.cocoa.RetainCount -analyzer-store=region -fblocks -verify %s
-// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -analyze -analyzer-checker=core,osx.coreFoundation.CFRetainRelease,osx.cocoa.ClassRelease,osx.cocoa.RetainCount -analyzer-store=region -fblocks -verify -x objective-c++ %s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -analyze -analyzer-checker=core,osx.coreFoundation.CFRetainRelease,osx.cocoa.ClassRelease,osx.cocoa.RetainCount -analyzer-store=region -fblocks -verify -Wno-objc-root-class %s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -analyze -analyzer-checker=core,osx.coreFoundation.CFRetainRelease,osx.cocoa.ClassRelease,osx.cocoa.RetainCount -analyzer-store=region -fblocks -verify -x objective-c++ -Wno-objc-root-class %s
#if __has_feature(attribute_ns_returns_retained)
#define NS_RETURNS_RETAINED __attribute__((ns_returns_retained))
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fblocks -analyze -analyzer-checker=osx.cocoa.UnusedIvars %s -verify
+// RUN: %clang_cc1 -fblocks -analyze -analyzer-checker=osx.cocoa.UnusedIvars -verify -Wno-objc-root-class %s
//===--- BEGIN: Delta-debugging reduced headers. --------------------------===//
Oops, something went wrong.

0 comments on commit b2f6820

Please sign in to comment.