]> granicus.if.org Git - clang/commitdiff
Eliminate the -f[no]objc-infer-related-result-type flags; there's no
authorDouglas Gregor <dgregor@apple.com>
Mon, 13 Jun 2011 16:42:53 +0000 (16:42 +0000)
committerDouglas Gregor <dgregor@apple.com>
Mon, 13 Jun 2011 16:42:53 +0000 (16:42 +0000)
reason to allow the user to control these semantics through a flag.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@132919 91177308-0d34-0410-b5e6-96231b3b80d8

18 files changed:
include/clang/Basic/LangOptions.h
include/clang/Driver/CC1Options.td
include/clang/Driver/Options.td
lib/Driver/Tools.cpp
lib/Frontend/CompilerInvocation.cpp
lib/Sema/SemaDeclObjC.cpp
lib/Serialization/ASTReader.cpp
lib/Serialization/ASTWriter.cpp
test/Analysis/misc-ps-eager-assume.m
test/Analysis/retain-release-gc-only.m
test/Analysis/retain-release.m
test/Analysis/retain-release.mm
test/Analysis/uninit-ps-rdar6145427.m
test/Analysis/variadic-method-types.m
test/Driver/rewrite-objc.m
test/SemaObjC/related-result-type-inference.m
test/SemaObjC/typedef-class.m
test/SemaObjCXX/related-result-type-inference.mm

index f0f1432ca0b8f35caa17970d7d6d573359cd38e4..c0e53021282e68a18dc0f50225886f377f498c87 100644 (file)
@@ -46,8 +46,7 @@ public:
   unsigned ObjCNonFragileABI : 1;  // Objective-C modern abi enabled
   unsigned ObjCNonFragileABI2 : 1;  // Objective-C enhanced modern abi enabled
   unsigned ObjCDefaultSynthProperties : 1; // Objective-C auto-synthesized properties.
-  unsigned ObjCInferRelatedResultType : 1; // Infer Objective-C related return
-                                           // types
+
   unsigned AppleKext         : 1;  // Allow apple kext features.
 
   unsigned PascalStrings     : 1;  // Allow Pascal strings
@@ -175,7 +174,6 @@ public:
     GC = ObjC1 = ObjC2 = ObjCNonFragileABI = ObjCNonFragileABI2 = 0;
     AppleKext = 0;
     ObjCDefaultSynthProperties = 0;
-    ObjCInferRelatedResultType = 0;
     NoConstantCFStrings = 0; InlineVisibilityHidden = 0;
     C99 = C1X = Microsoft = Borland = CPlusPlus = CPlusPlus0x = 0;
     CXXOperatorNames = PascalStrings = WritableStrings = ConstStrings = 0;
index 14d8f67b9de3abf1060a97e05379e92e25d4c548..155ecae5798a0bfc1ff3bb24f63803d6cef824de 100644 (file)
@@ -493,8 +493,6 @@ def print_ivar_layout : Flag<"-print-ivar-layout">,
   HelpText<"Enable Objective-C Ivar layout bitmap print trace">;
 def fobjc_nonfragile_abi : Flag<"-fobjc-nonfragile-abi">,
   HelpText<"enable objective-c's nonfragile abi">;
-def fobjc_infer_related_result_type : Flag<"-fobjc-infer-related-result-type">,
-  HelpText<"infer Objective-C related result type based on method family">;
 def ftrapv : Flag<"-ftrapv">,
   HelpText<"Trap on integer overflow">;
 def ftrapv_handler : Separate<"-ftrapv-handler">,
index 72039766d9077cefb8908234c322e42e1bd97c0a..23b351c78a1b7abdf98bba16398f30933f854f08 100644 (file)
@@ -392,10 +392,6 @@ def fobjc_gc_only : Flag<"-fobjc-gc-only">, Group<f_Group>;
 def fobjc_gc : Flag<"-fobjc-gc">, Group<f_Group>;
 def fobjc_legacy_dispatch : Flag<"-fobjc-legacy-dispatch">, Group<f_Group>;
 def fobjc_new_property : Flag<"-fobjc-new-property">, Group<clang_ignored_f_Group>;
-def fobjc_infer_related_result_type : Flag<"-fobjc-infer-related-result-type">, 
-                                      Group<f_Group>;
-def fno_objc_infer_related_result_type : Flag<
-  "-fno-objc-infer-related-result-type">, Group<f_Group>;
 
 // Objective-C ABI options.
 def fobjc_abi_version_EQ : Joined<"-fobjc-abi-version=">, Group<f_Group>;
index 8cd7adc42e84ca7d15d43b7a5025ca9f5ffdfab8..bc3ff6873b71b8124cdc917ade696183e46cfad8 100644 (file)
@@ -1542,12 +1542,6 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
                     options::OPT_fno_lax_vector_conversions))
     CmdArgs.push_back("-fno-lax-vector-conversions");
 
-  // -fobjc-infer-related-result-type is the default.
-  if (Args.hasFlag(options::OPT_fobjc_infer_related_result_type, 
-                   options::OPT_fno_objc_infer_related_result_type, 
-                   /*Default=*/true))
-    CmdArgs.push_back("-fobjc-infer-related-result-type");
-  
   // Handle -fobjc-gc and -fobjc-gc-only. They are exclusive, and -fobjc-gc-only
   // takes precedence.
   const Arg *GCArg = Args.getLastArg(options::OPT_fobjc_gc_only);
index 536512a121e946a4b9a28cd256cf64f42e880f1f..b8b5011bbfa939abd593f574d706ab55ca3b293d 100644 (file)
@@ -670,9 +670,6 @@ static void LangOptsToArgs(const LangOptions &Opts,
       Res.push_back("-fobjc-gc-only");
     }
   }
-  if (Opts.ObjCInferRelatedResultType)
-    Res.push_back("-fobjc-infer-related-result-type");
-  
   if (Opts.AppleKext)
     Res.push_back("-fapple-kext");
   
@@ -1488,9 +1485,6 @@ static void ParseLangArgs(LangOptions &Opts, ArgList &Args, InputKind IK,
   else if (Args.hasArg(OPT_fobjc_gc))
     Opts.setGCMode(LangOptions::HybridGC);
   
-  if (Args.hasArg(OPT_fobjc_infer_related_result_type))
-    Opts.ObjCInferRelatedResultType = 1;
-  
   if (Args.hasArg(OPT_fapple_kext)) {
     if (!Opts.CPlusPlus)
       Diags.Report(diag::warn_c_kext);
index bfa2ef45d08de78a2d3324ea7d090bd4c1d524da..0b032f8701fc5607b45a4775d804f78e9f41a8ff 100644 (file)
@@ -2112,8 +2112,7 @@ Decl *Sema::ActOnMethodDeclaration(
     mergeObjCMethodDecls(ObjCMethod, InterfaceMD);
   }
   
-  if (!ObjCMethod->hasRelatedResultType() && 
-      getLangOptions().ObjCInferRelatedResultType) {
+  if (!ObjCMethod->hasRelatedResultType()) {
     bool InferRelatedResultType = false;
     switch (ObjCMethod->getMethodFamily()) {
     case OMF_None:
index 8fb20d22b7defefec142e6cab295e8b1eb03c846..3c3993f412d30b6724d1c884c3ddf2fc690511f7 100644 (file)
@@ -92,7 +92,6 @@ PCHValidator::ReadLanguageOptions(const LangOptions &LangOpts) {
   PARSE_LANGOPT_IMPORTANT(AppleKext, diag::warn_pch_apple_kext);
   PARSE_LANGOPT_IMPORTANT(ObjCDefaultSynthProperties,
                           diag::warn_pch_objc_auto_properties);
-  PARSE_LANGOPT_BENIGN(ObjCInferRelatedResultType)
   PARSE_LANGOPT_IMPORTANT(NoConstantCFStrings,
                           diag::warn_pch_no_constant_cfstrings);
   PARSE_LANGOPT_BENIGN(PascalStrings);
@@ -2935,7 +2934,6 @@ bool ASTReader::ParseLanguageOptions(
     PARSE_LANGOPT(ObjCNonFragileABI2);
     PARSE_LANGOPT(AppleKext);
     PARSE_LANGOPT(ObjCDefaultSynthProperties);
-    PARSE_LANGOPT(ObjCInferRelatedResultType);
     PARSE_LANGOPT(NoConstantCFStrings);
     PARSE_LANGOPT(PascalStrings);
     PARSE_LANGOPT(WritableStrings);
index ba9032e0d33e0cc299e01aa0da38c022b309a731..194d6c31cfa29ca3ab0d88e46ad706e6be17f96f 100644 (file)
@@ -1050,7 +1050,6 @@ void ASTWriter::WriteLanguageOptions(const LangOptions &LangOpts) {
   Record.push_back(LangOpts.AppleKext);          // Apple's kernel extensions ABI
   Record.push_back(LangOpts.ObjCDefaultSynthProperties); // Objective-C auto-synthesized
                                                       // properties enabled.
-  Record.push_back(LangOpts.ObjCInferRelatedResultType);
   Record.push_back(LangOpts.NoConstantCFStrings); // non cfstring generation enabled..
 
   Record.push_back(LangOpts.PascalStrings);  // Allow Pascal strings
index 649c4b07f543956aea58cf96af15613e1f9f3bd2..4380a187b800212fdd47250892eda6a9c2a53be9 100644 (file)
@@ -12,6 +12,7 @@ typedef struct _NSZone NSZone;
 @end  @protocol NSCoding  - (void)encodeWithCoder:(NSCoder *)aCoder;
 @end    @interface NSObject <NSObject> {}
 + (id)alloc;
+- (id)init;
 @end  typedef struct {}
 NSFastEnumerationState;
 @protocol NSFastEnumeration  - (NSUInteger)countByEnumeratingWithState:(NSFastEnumerationState *)state objects:(id *)stackbuf count:(NSUInteger)len;
index cbf00a27721d8da7ccfcd261980541994bd1d6c2..ee1a6b4b782e0149c12cafdc3e15f93ce72241dd 100644 (file)
@@ -113,6 +113,7 @@ NSFastEnumerationState;
 @end       @interface NSAutoreleasePool : NSObject {
 }
 - (void)drain;
+- (id)init;
 @end extern NSString * const NSBundleDidLoadNotification;
 typedef double NSTimeInterval;
 @interface NSDate : NSObject <NSCopying, NSCoding>  - (NSTimeInterval)timeIntervalSinceReferenceDate;
index 7af14f129c3f656309f3b684672266f294c67b84..5c67941c426c9e868a6874a0baee34ceb87d37f5 100644 (file)
@@ -116,6 +116,7 @@ typedef struct _NSZone NSZone;
 - (id)retain;
 - (oneway void)release;
 - (id)autorelease;
+- (id)init;
 @end  @protocol NSCopying  - (id)copyWithZone:(NSZone *)zone;
 @end  @protocol NSMutableCopying  - (id)mutableCopyWithZone:(NSZone *)zone;
 @end  @protocol NSCoding  - (void)encodeWithCoder:(NSCoder *)aCoder;
@@ -1445,7 +1446,7 @@ static void rdar_8724287(CFErrorRef error)
     while (error_to_dump != ((void*)0)) {
         CFDictionaryRef info;
 
-        info = CFErrorCopyUserInfo(error_to_dump); // expected-warning{{Potential leak of an object allocated on line 1448 and stored into 'info'}}
+        info = CFErrorCopyUserInfo(error_to_dump); // expected-warning{{Potential leak of an object allocated on line 1449 and stored into 'info'}}
 
         if (info != ((void*)0)) {
         }
index 0faeb1a2a30059fa4be354f9ba07b35650919959..bdc3dc03964a40a6119b100b7aafd11f52fbe690 100644 (file)
@@ -121,6 +121,7 @@ typedef struct _NSZone NSZone;
 + (id)allocWithZone:(NSZone *)zone;
 + (id)alloc;
 - (void)dealloc;
+- (id)init;
 @end
 @interface NSObject (NSCoderMethods)
 - (id)awakeAfterUsingCoder:(NSCoder *)aDecoder;
index f1794068d5e16f72eab592141ff0a28b8ef09685..f4df91396a84441c3838777b3aff5c190d3bc750 100644 (file)
@@ -11,7 +11,10 @@ typedef struct _NSZone NSZone;
 @protocol NSObject  - (BOOL)isEqual:(id)object; @end
 @protocol NSCopying  - (id)copyWithZone:(NSZone *)zone; @end
 @protocol NSCoding  - (void)encodeWithCoder:(NSCoder *)aCoder; @end
-@interface NSObject <NSObject> {} + (id)alloc; @end
+@interface NSObject <NSObject> {} 
++ (id)alloc; 
+- (id)init;
+@end
 extern id NSAllocateObject(Class aClass, NSUInteger extraBytes, NSZone *zone);
 @interface NSValue : NSObject <NSCopying, NSCoding>  - (void)getValue:(void *)value; @end
 @class NSString, NSData;
index 018956ab1b2d76b7292a187f123be135f062e1d9..03c309a5004aa8572f2fdb7b694ce184566c4327 100644 (file)
@@ -73,13 +73,13 @@ void f(id a, id<P> b, C* c, C<P> *d, FooType fooType, BarType barType) {
   [NSDictionary dictionaryWithObjectsAndKeys:@"Foo", "Bar", nil]; // expected-warning {{Argument to 'NSDictionary' method 'dictionaryWithObjectsAndKeys:' should be an Objective-C pointer type, not 'char *'}}
   [NSSet setWithObjects:@"Foo", "Bar", nil]; // expected-warning {{Argument to 'NSSet' method 'setWithObjects:' should be an Objective-C pointer type, not 'char *'}}
 
-  [[[NSArray alloc] initWithObjects:@"Foo", "Bar", nil] autorelease]; // expected-warning {{Argument to method 'initWithObjects:' should be an Objective-C pointer type, not 'char *'}}
-  [[[NSDictionary alloc] initWithObjectsAndKeys:@"Foo", "Bar", nil] autorelease]; // expected-warning {{Argument to method 'initWithObjectsAndKeys:' should be an Objective-C pointer type, not 'char *'}}
+  [[[NSArray alloc] initWithObjects:@"Foo", "Bar", nil] autorelease]; // expected-warning {{Argument to 'NSArray' method 'initWithObjects:' should be an Objective-C pointer type, not 'char *'}}
+  [[[NSDictionary alloc] initWithObjectsAndKeys:@"Foo", "Bar", nil] autorelease]; // expected-warning {{Argument to 'NSDictionary' method 'initWithObjectsAndKeys:' should be an Objective-C pointer type, not 'char *'}}
   [[[NSDictionary alloc] initWithObjectsAndKeys:@"Foo", (void*) 0, nil] autorelease]; // no-warning
   [[[NSDictionary alloc] initWithObjectsAndKeys:@"Foo", kCGImageSourceShouldCache, nil] autorelease]; // no-warning
   [[[NSDictionary alloc] initWithObjectsAndKeys:@"Foo", fooType, nil] autorelease]; // no-warning
-  [[[NSDictionary alloc] initWithObjectsAndKeys:@"Foo", barType, nil] autorelease]; // expected-warning {{Argument to method 'initWithObjectsAndKeys:' should be an Objective-C pointer type, not 'BarType'}}
-  [[[NSSet alloc] initWithObjects:@"Foo", "Bar", nil] autorelease]; // expected-warning {{Argument to method 'initWithObjects:' should be an Objective-C pointer type, not 'char *'}}
+  [[[NSDictionary alloc] initWithObjectsAndKeys:@"Foo", barType, nil] autorelease]; // expected-warning {{Argument to 'NSDictionary' method 'initWithObjectsAndKeys:' should be an Objective-C pointer type, not 'BarType'}}
+  [[[NSSet alloc] initWithObjects:@"Foo", "Bar", nil] autorelease]; // expected-warning {{Argument to 'NSSet' method 'initWithObjects:' should be an Objective-C pointer type, not 'char *'}}
 }
 
 // This previously crashed the variadic argument checker.
index 2fe2ccec6a7c9dab3311b26b13508c16b5db4827..e3d2c0f46d355701456e5aa64f6d67a391420189 100644 (file)
@@ -3,7 +3,7 @@
 // TEST0: clang{{.*}}" "-cc1"
 // TEST0: "-rewrite-objc"
 // FIXME: CHECK-NOT is broken somehow, it doesn't work here. Check adjacency instead.
-// TEST0: "-fmessage-length" "0" "-fobjc-infer-related-result-type" "-fobjc-exceptions" "-fdiagnostics-show-option"
+// TEST0: "-fmessage-length" "0" "-fobjc-exceptions" "-fdiagnostics-show-option"
 // TEST0: rewrite-objc.m"
 
 // RUN: not %clang -ccc-no-clang -ccc-host-triple unknown -rewrite-objc %s -o - -### 2>&1 | \
index f5399180c40058762c1122bd5a063e47cc7c8bcf..094f19a6712994be89f525c06b3426d58d6c0a14 100644 (file)
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fobjc-infer-related-result-type -verify %s
+// RUN: %clang_cc1 -verify %s
 
 @interface Unrelated
 @end
index 0f7e6822c4f951749c29649b454ed9959d2fc5e5..c983195b243e6d899826835afe274e2e69109d85 100644 (file)
@@ -5,7 +5,7 @@ typedef struct _NSZone NSZone;
 
 @class NSInvocation, NSMethodSignature, NSCoder, NSString, NSEnumerator;
 
-@protocol NSObject - (BOOL) isEqual:(id) object; @end
+@protocol NSObject - (BOOL) isEqual:(id) object; - (id)init; @end
 @protocol NSCopying - (id) copyWithZone:(NSZone *) zone; @end
 @protocol NSCoding - (void) encodeWithCoder:(NSCoder *) aCoder; @end
 
index c3cab05194fcdb26bb8009e3014eee48f8248ae0..675e6acbda143f5a8b147fa0ecfd1c8f0b2adb91 100644 (file)
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fobjc-infer-related-result-type -verify %s
+// RUN: %clang_cc1 -verify %s
 
 @interface Unrelated
 @end