[llvm-branch-commits] [cfe-branch] r122857 - in /cfe/branches/Apple/whitney: include/clang/Basic/ include/clang/Driver/ lib/Driver/ lib/Frontend/ lib/Sema/ lib/Serialization/ test/CodeGenObjC/ test/SemaObjC/

Daniel Dunbar daniel at zuster.org
Tue Jan 4 18:19:48 PST 2011


Author: ddunbar
Date: Tue Jan  4 20:19:48 2011
New Revision: 122857

URL: http://llvm.org/viewvc/llvm-project?rev=122857&view=rev
Log:
Merge r122519:
--
Author: Ted Kremenek <kremenek at apple.com>
Date:   Thu Dec 23 21:35:43 2010 +0000

    Add -fobjc-default-synthesized-properties flag
    to allow us to explicitly control whether or
    not Objective-C properties are default synthesized.
    Currently this feature only works when using
    the -fobjc-non-fragile-abi2 flag (so there is
    no functionality change), but we can now turn
    off this feature without turning off all the features
    coupled with -fobjc-non-fragile-abi2.

*** MANUAL MERGE ***

Modified:
    cfe/branches/Apple/whitney/include/clang/Basic/DiagnosticFrontendKinds.td
    cfe/branches/Apple/whitney/include/clang/Basic/LangOptions.h
    cfe/branches/Apple/whitney/include/clang/Driver/CC1Options.td
    cfe/branches/Apple/whitney/include/clang/Driver/Options.td
    cfe/branches/Apple/whitney/include/clang/Driver/ToolChain.h
    cfe/branches/Apple/whitney/lib/Driver/ToolChains.h
    cfe/branches/Apple/whitney/lib/Driver/Tools.cpp
    cfe/branches/Apple/whitney/lib/Frontend/CompilerInvocation.cpp
    cfe/branches/Apple/whitney/lib/Sema/SemaDeclObjC.cpp
    cfe/branches/Apple/whitney/lib/Serialization/ASTReader.cpp
    cfe/branches/Apple/whitney/lib/Serialization/ASTWriter.cpp
    cfe/branches/Apple/whitney/test/CodeGenObjC/debug-info-default-synth-ivar.m
    cfe/branches/Apple/whitney/test/SemaObjC/default-synthesize-1.m
    cfe/branches/Apple/whitney/test/SemaObjC/default-synthesize.m
    cfe/branches/Apple/whitney/test/SemaObjC/direct-synthesized-ivar-access.m
    cfe/branches/Apple/whitney/test/SemaObjC/synth-provisional-ivars.m
    cfe/branches/Apple/whitney/test/SemaObjC/synthesized-ivar.m

Modified: cfe/branches/Apple/whitney/include/clang/Basic/DiagnosticFrontendKinds.td
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/whitney/include/clang/Basic/DiagnosticFrontendKinds.td?rev=122857&r1=122856&r2=122857&view=diff
==============================================================================
--- cfe/branches/Apple/whitney/include/clang/Basic/DiagnosticFrontendKinds.td (original)
+++ cfe/branches/Apple/whitney/include/clang/Basic/DiagnosticFrontendKinds.td Tue Jan  4 20:19:48 2011
@@ -129,6 +129,9 @@
     "PCH file was compiled with the %select{32-bit|enhanced non-fragile}0 "
     "Objective-C ABI but the %select{32-bit|enhanced non-fragile}1 "
     "Objective-C ABI is selected">;
+def warn_pch_objc_auto_properties : Error<
+    "PCH file was compiled %select{with|without}0 support for auto-synthesized "
+    "@properties but it is currently %select{disabled|enabled}1">;
 def warn_pch_no_constant_cfstrings : Error<
     "Objctive-C NSstring generation support was %select{disabled|enabled}0 "
     "in PCH file but currently %select{disabled|enabled}1">; 

Modified: cfe/branches/Apple/whitney/include/clang/Basic/LangOptions.h
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/whitney/include/clang/Basic/LangOptions.h?rev=122857&r1=122856&r2=122857&view=diff
==============================================================================
--- cfe/branches/Apple/whitney/include/clang/Basic/LangOptions.h (original)
+++ cfe/branches/Apple/whitney/include/clang/Basic/LangOptions.h Tue Jan  4 20:19:48 2011
@@ -44,6 +44,7 @@
   unsigned ObjC2             : 1;  // Objective-C 2 support enabled.
   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 PascalStrings     : 1;  // Allow Pascal strings
   unsigned WritableStrings   : 1;  // Allow writable strings
@@ -147,6 +148,7 @@
     GNUMode = GNUKeywords = ImplicitInt = Digraphs = 0;
     HexFloats = 0;
     GC = ObjC1 = ObjC2 = ObjCNonFragileABI = ObjCNonFragileABI2 = 0;
+    ObjCDefaultSynthProperties = 0;
     NoConstantCFStrings = 0; InlineVisibilityHidden = 0;
     C99 = Microsoft = Borland = CPlusPlus = CPlusPlus0x = 0;
     CXXOperatorNames = PascalStrings = WritableStrings = ConstStrings = 0;

Modified: cfe/branches/Apple/whitney/include/clang/Driver/CC1Options.td
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/whitney/include/clang/Driver/CC1Options.td?rev=122857&r1=122856&r2=122857&view=diff
==============================================================================
--- cfe/branches/Apple/whitney/include/clang/Driver/CC1Options.td (original)
+++ cfe/branches/Apple/whitney/include/clang/Driver/CC1Options.td Tue Jan  4 20:19:48 2011
@@ -459,6 +459,8 @@
   HelpText<"Use GC exclusively for Objective-C related memory management">;
 def fobjc_dispatch_method_EQ : Joined<"-fobjc-dispatch-method=">,
   HelpText<"Objective-C dispatch method to use">;
+def fobjc_default_synthesize_properties : Flag<"-fobjc-default-synthesize-properties">,
+  HelpText<"enable the default synthesis of Objective-C properties">;
 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">,

Modified: cfe/branches/Apple/whitney/include/clang/Driver/Options.td
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/whitney/include/clang/Driver/Options.td?rev=122857&r1=122856&r2=122857&view=diff
==============================================================================
--- cfe/branches/Apple/whitney/include/clang/Driver/Options.td (original)
+++ cfe/branches/Apple/whitney/include/clang/Driver/Options.td Tue Jan  4 20:19:48 2011
@@ -336,6 +336,8 @@
 def fno_math_errno : Flag<"-fno-math-errno">, Group<f_Group>;
 def fno_merge_all_constants : Flag<"-fno-merge-all-constants">, Group<f_Group>;
 def fno_ms_extensions : Flag<"-fno-ms-extensions">, Group<f_Group>;
+def fno_objc_default_synthesize_properties 
+  : Flag<"-fno-objc-default-synthesize-properties">, Group<f_Group>;
 def fno_objc_legacy_dispatch : Flag<"-fno-objc-legacy-dispatch">, Group<f_Group>;
 def fno_omit_frame_pointer : Flag<"-fno-omit-frame-pointer">, Group<f_Group>;
 def fno_pascal_strings : Flag<"-fno-pascal-strings">, Group<f_Group>;
@@ -355,6 +357,7 @@
 def fno_zero_initialized_in_bss : Flag<"-fno-zero-initialized-in-bss">, Group<f_Group>;
 def fobjc_atdefs : Flag<"-fobjc-atdefs">, Group<clang_ignored_f_Group>;
 def fobjc_call_cxx_cdtors : Flag<"-fobjc-call-cxx-cdtors">, Group<clang_ignored_f_Group>;
+def fobjc_default_synthesize_properties : Flag<"-fobjc-default-synthesize-properties">, Group<f_Group>;
 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>;

Modified: cfe/branches/Apple/whitney/include/clang/Driver/ToolChain.h
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/whitney/include/clang/Driver/ToolChain.h?rev=122857&r1=122856&r2=122857&view=diff
==============================================================================
--- cfe/branches/Apple/whitney/include/clang/Driver/ToolChain.h (original)
+++ cfe/branches/Apple/whitney/include/clang/Driver/ToolChain.h Tue Jan  4 20:19:48 2011
@@ -108,11 +108,15 @@
 
   /// IsBlocksDefault - Does this tool chain enable -fblocks by default.
   virtual bool IsBlocksDefault() const { return false; }
-
+  
   /// IsIntegratedAssemblerDefault - Does this tool chain enable -integrated-as
   /// by default.
   virtual bool IsIntegratedAssemblerDefault() const { return false; }
 
+  /// IsObjCDefaultSynthPropertiesDefault - Does this tool chain enable
+  /// -fobjc-default-synthesize-properties by default.
+  virtual bool IsObjCDefaultSynthPropertiesDefault() const { return false; }
+
   /// IsObjCNonFragileABIDefault - Does this tool chain set
   /// -fobjc-nonfragile-abi by default.
   virtual bool IsObjCNonFragileABIDefault() const { return false; }

Modified: cfe/branches/Apple/whitney/lib/Driver/ToolChains.h
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/whitney/lib/Driver/ToolChains.h?rev=122857&r1=122856&r2=122857&view=diff
==============================================================================
--- cfe/branches/Apple/whitney/lib/Driver/ToolChains.h (original)
+++ cfe/branches/Apple/whitney/lib/Driver/ToolChains.h Tue Jan  4 20:19:48 2011
@@ -176,6 +176,12 @@
             getTriple().getArch() == llvm::Triple::x86_64);
 #endif
   }
+  
+  virtual bool IsObjCDefaultSynthPropertiesDefault() const {
+    // Always allow default synthesized properties on Darwin.
+    return true;
+  }
+
   virtual bool IsObjCNonFragileABIDefault() const {
     // Non-fragile ABI is default for everything but i386.
     return getTriple().getArch() != llvm::Triple::x86;

Modified: cfe/branches/Apple/whitney/lib/Driver/Tools.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/whitney/lib/Driver/Tools.cpp?rev=122857&r1=122856&r2=122857&view=diff
==============================================================================
--- cfe/branches/Apple/whitney/lib/Driver/Tools.cpp (original)
+++ cfe/branches/Apple/whitney/lib/Driver/Tools.cpp Tue Jan  4 20:19:48 2011
@@ -1422,6 +1422,13 @@
           CmdArgs.push_back("-fobjc-dispatch-method=non-legacy");
       }
     }
+    
+    // -fobjc-default-synthesize-properties=0 is default.
+    if (Args.hasFlag(options::OPT_fobjc_default_synthesize_properties,
+                     options::OPT_fno_objc_default_synthesize_properties,
+                     getToolChain().IsObjCDefaultSynthPropertiesDefault())) {
+      CmdArgs.push_back("-fobjc-default-synthesize-properties");
+    }
   }
 
   if (!Args.hasFlag(options::OPT_fassume_sane_operator_new,

Modified: cfe/branches/Apple/whitney/lib/Frontend/CompilerInvocation.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/whitney/lib/Frontend/CompilerInvocation.cpp?rev=122857&r1=122856&r2=122857&view=diff
==============================================================================
--- cfe/branches/Apple/whitney/lib/Frontend/CompilerInvocation.cpp (original)
+++ cfe/branches/Apple/whitney/lib/Frontend/CompilerInvocation.cpp Tue Jan  4 20:19:48 2011
@@ -546,6 +546,8 @@
     Res.push_back("-fobjc-nonfragile-abi");
   if (Opts.ObjCNonFragileABI2)
     Res.push_back("-fobjc-nonfragile-abi2");
+  if (Opts.ObjCDefaultSynthProperties)
+    Res.push_back("-fobjc-default-synthesize-properties");
   // NoInline is implicit.
   if (!Opts.CXXOperatorNames)
     Res.push_back("-fno-operator-names");
@@ -1380,6 +1382,8 @@
   Opts.ObjCNonFragileABI2 = Args.hasArg(OPT_fobjc_nonfragile_abi2);
   if (Opts.ObjCNonFragileABI2)
     Opts.ObjCNonFragileABI = true;
+  Opts.ObjCDefaultSynthProperties =
+    Args.hasArg(OPT_fobjc_default_synthesize_properties);
   Opts.CatchUndefined = Args.hasArg(OPT_fcatch_undefined_behavior);
   Opts.EmitAllDecls = Args.hasArg(OPT_femit_all_decls);
   Opts.PICLevel = Args.getLastArgIntValue(OPT_pic_level, 0, Diags);

Modified: cfe/branches/Apple/whitney/lib/Sema/SemaDeclObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/whitney/lib/Sema/SemaDeclObjC.cpp?rev=122857&r1=122856&r2=122857&view=diff
==============================================================================
--- cfe/branches/Apple/whitney/lib/Sema/SemaDeclObjC.cpp (original)
+++ cfe/branches/Apple/whitney/lib/Sema/SemaDeclObjC.cpp Tue Jan  4 20:19:48 2011
@@ -1094,7 +1094,8 @@
   // Check and see if properties declared in the interface have either 1)
   // an implementation or 2) there is a @synthesize/@dynamic implementation
   // of the property in the @implementation.
-  if (isa<ObjCInterfaceDecl>(CDecl) && !LangOpts.ObjCNonFragileABI2)
+  if (isa<ObjCInterfaceDecl>(CDecl) &&
+        !(LangOpts.ObjCDefaultSynthProperties && LangOpts.ObjCNonFragileABI2))
     DiagnoseUnimplementedProperties(S, IMPDecl, CDecl, InsMap);
       
   llvm::DenseSet<Selector> ClsMap;
@@ -1542,7 +1543,8 @@
       ImplMethodsVsClassMethods(S, IC, IDecl);
       AtomicPropertySetterGetterRules(IC, IDecl);
   
-      if (LangOpts.ObjCNonFragileABI2)
+      if (LangOpts.ObjCDefaultSynthProperties &&
+          LangOpts.ObjCNonFragileABI2)
         while (IDecl->getSuperClass()) {
           DiagnoseDuplicateIvars(IDecl, IDecl->getSuperClass());
           IDecl = IDecl->getSuperClass();

Modified: cfe/branches/Apple/whitney/lib/Serialization/ASTReader.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/whitney/lib/Serialization/ASTReader.cpp?rev=122857&r1=122856&r2=122857&view=diff
==============================================================================
--- cfe/branches/Apple/whitney/lib/Serialization/ASTReader.cpp (original)
+++ cfe/branches/Apple/whitney/lib/Serialization/ASTReader.cpp Tue Jan  4 20:19:48 2011
@@ -82,6 +82,8 @@
   PARSE_LANGOPT_IMPORTANT(ObjC2, diag::warn_pch_objective_c2);
   PARSE_LANGOPT_IMPORTANT(ObjCNonFragileABI, diag::warn_pch_nonfragile_abi);
   PARSE_LANGOPT_IMPORTANT(ObjCNonFragileABI2, diag::warn_pch_nonfragile_abi2);
+  PARSE_LANGOPT_IMPORTANT(ObjCDefaultSynthProperties,
+                          diag::warn_pch_objc_auto_properties);
   PARSE_LANGOPT_IMPORTANT(NoConstantCFStrings,
                           diag::warn_pch_no_constant_cfstrings);
   PARSE_LANGOPT_BENIGN(PascalStrings);
@@ -2605,6 +2607,7 @@
     PARSE_LANGOPT(ObjC2);
     PARSE_LANGOPT(ObjCNonFragileABI);
     PARSE_LANGOPT(ObjCNonFragileABI2);
+    PARSE_LANGOPT(ObjCDefaultSynthProperties);
     PARSE_LANGOPT(NoConstantCFStrings);
     PARSE_LANGOPT(PascalStrings);
     PARSE_LANGOPT(WritableStrings);

Modified: cfe/branches/Apple/whitney/lib/Serialization/ASTWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/whitney/lib/Serialization/ASTWriter.cpp?rev=122857&r1=122856&r2=122857&view=diff
==============================================================================
--- cfe/branches/Apple/whitney/lib/Serialization/ASTWriter.cpp (original)
+++ cfe/branches/Apple/whitney/lib/Serialization/ASTWriter.cpp Tue Jan  4 20:19:48 2011
@@ -842,6 +842,8 @@
                                                  // modern abi enabled.
   Record.push_back(LangOpts.ObjCNonFragileABI2); // Objective-C enhanced
                                                  // modern abi enabled.
+  Record.push_back(LangOpts.ObjCDefaultSynthProperties); // Objective-C auto-synthesized
+                                                      // properties enabled.
   Record.push_back(LangOpts.NoConstantCFStrings); // non cfstring generation enabled..
 
   Record.push_back(LangOpts.PascalStrings);  // Allow Pascal strings

Modified: cfe/branches/Apple/whitney/test/CodeGenObjC/debug-info-default-synth-ivar.m
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/whitney/test/CodeGenObjC/debug-info-default-synth-ivar.m?rev=122857&r1=122856&r2=122857&view=diff
==============================================================================
--- cfe/branches/Apple/whitney/test/CodeGenObjC/debug-info-default-synth-ivar.m (original)
+++ cfe/branches/Apple/whitney/test/CodeGenObjC/debug-info-default-synth-ivar.m Tue Jan  4 20:19:48 2011
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi2 -emit-llvm -g %s -o %t 
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi2 -fobjc-default-synthesize-properties -emit-llvm -g %s -o %t 
 // RUN: grep DW_TAG_member %t | count 5
 // rdar://8493239
 

Modified: cfe/branches/Apple/whitney/test/SemaObjC/default-synthesize-1.m
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/whitney/test/SemaObjC/default-synthesize-1.m?rev=122857&r1=122856&r2=122857&view=diff
==============================================================================
--- cfe/branches/Apple/whitney/test/SemaObjC/default-synthesize-1.m (original)
+++ cfe/branches/Apple/whitney/test/SemaObjC/default-synthesize-1.m Tue Jan  4 20:19:48 2011
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -fobjc-nonfragile-abi2 -verify %s
+// RUN: %clang_cc1 -fsyntax-only -fobjc-nonfragile-abi2 -fobjc-default-synthesize-properties -verify %s
 
 @interface NSObject 
 - (void) release;

Modified: cfe/branches/Apple/whitney/test/SemaObjC/default-synthesize.m
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/whitney/test/SemaObjC/default-synthesize.m?rev=122857&r1=122856&r2=122857&view=diff
==============================================================================
--- cfe/branches/Apple/whitney/test/SemaObjC/default-synthesize.m (original)
+++ cfe/branches/Apple/whitney/test/SemaObjC/default-synthesize.m Tue Jan  4 20:19:48 2011
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -fobjc-nonfragile-abi2 -verify %s
+// RUN: %clang_cc1 -fsyntax-only -fobjc-nonfragile-abi2 -fobjc-default-synthesize-properties -verify %s
 
 @interface NSString @end
 

Modified: cfe/branches/Apple/whitney/test/SemaObjC/direct-synthesized-ivar-access.m
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/whitney/test/SemaObjC/direct-synthesized-ivar-access.m?rev=122857&r1=122856&r2=122857&view=diff
==============================================================================
--- cfe/branches/Apple/whitney/test/SemaObjC/direct-synthesized-ivar-access.m (original)
+++ cfe/branches/Apple/whitney/test/SemaObjC/direct-synthesized-ivar-access.m Tue Jan  4 20:19:48 2011
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -Wnonfragile-abi2 -fsyntax-only -fobjc-nonfragile-abi2 -verify %s
+// RUN: %clang_cc1 -Wnonfragile-abi2 -fsyntax-only -fobjc-nonfragile-abi2 -fobjc-default-synthesize-properties -verify %s
 // rdar://8673791
 
 @interface I {

Modified: cfe/branches/Apple/whitney/test/SemaObjC/synth-provisional-ivars.m
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/whitney/test/SemaObjC/synth-provisional-ivars.m?rev=122857&r1=122856&r2=122857&view=diff
==============================================================================
--- cfe/branches/Apple/whitney/test/SemaObjC/synth-provisional-ivars.m (original)
+++ cfe/branches/Apple/whitney/test/SemaObjC/synth-provisional-ivars.m Tue Jan  4 20:19:48 2011
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -fobjc-nonfragile-abi2 -verify %s
+// RUN: %clang_cc1 -fsyntax-only -fobjc-nonfragile-abi2 -fobjc-default-synthesize-properties -verify %s
 
 int bar;
 

Modified: cfe/branches/Apple/whitney/test/SemaObjC/synthesized-ivar.m
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/whitney/test/SemaObjC/synthesized-ivar.m?rev=122857&r1=122856&r2=122857&view=diff
==============================================================================
--- cfe/branches/Apple/whitney/test/SemaObjC/synthesized-ivar.m (original)
+++ cfe/branches/Apple/whitney/test/SemaObjC/synthesized-ivar.m Tue Jan  4 20:19:48 2011
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -fobjc-nonfragile-abi2 -verify %s
+// RUN: %clang_cc1 -fsyntax-only -fobjc-nonfragile-abi2 -fobjc-default-synthesize-properties -verify %s
 @interface I
 {
 }





More information about the llvm-branch-commits mailing list