Merge Dib to Apple gcc 5646.

llvm-svn: 71286
diff --git a/llvm-gcc-4.2/gcc/ChangeLog.apple b/llvm-gcc-4.2/gcc/ChangeLog.apple
index 8f718bc..882f9f0 100644
--- a/llvm-gcc-4.2/gcc/ChangeLog.apple
+++ b/llvm-gcc-4.2/gcc/ChangeLog.apple
@@ -1,3 +1,9 @@
+2009-04-08  Jim Grosbach <grosbach@apple.com>
+
+	Radar 6738583
+	* config/arm/arm.c (arm_init_cumulative_args): Always short call local
+	functions.
+
 2009-04-06  Stuart Hastings  <stuart@apple.com>
 
 	Radar 6755006
diff --git a/llvm-gcc-4.2/gcc/config/arm/arm.c b/llvm-gcc-4.2/gcc/config/arm/arm.c
index cf5d44e..152b2a7 100644
--- a/llvm-gcc-4.2/gcc/config/arm/arm.c
+++ b/llvm-gcc-4.2/gcc/config/arm/arm.c
@@ -3055,7 +3055,8 @@
 void
 arm_init_cumulative_args (CUMULATIVE_ARGS *pcum, tree fntype,
 			  rtx libname  ATTRIBUTE_UNUSED,
-			  tree fndecl ATTRIBUTE_UNUSED)
+/* APPLE LOCAL 6738583 -mlong-calls PIC static functions */
+			  tree fndecl)
 {
   /* On the ARM, the offset starts at 0.  */
   pcum->nregs = 0;
@@ -3075,6 +3076,10 @@
 	pcum->call_cookie = CALL_SHORT;
       else if (lookup_attribute ("long_call", TYPE_ATTRIBUTES (fntype)))
 	pcum->call_cookie = CALL_LONG;
+      /* APPLE LOCAL begin 6738583 -mlong-calls PIC static functions */
+      else if (fndecl && ! TREE_PUBLIC (fndecl))
+	pcum->call_cookie = CALL_SHORT;
+      /* APPLE LOCAL end 6738583 -mlong-calls PIC static functions */
     }
 
   /* Varargs vectors are treated the same as long long.
diff --git a/llvm-gcc-4.2/gcc/cp/mangle.c b/llvm-gcc-4.2/gcc/cp/mangle.c
index e0bbb9c..6e652b0 100644
--- a/llvm-gcc-4.2/gcc/cp/mangle.c
+++ b/llvm-gcc-4.2/gcc/cp/mangle.c
@@ -1468,6 +1468,10 @@
 	  tree type = VEC_index (tree, local_classes, ix);
 	  if (type == entity)
 	    break;
+	  /* APPLE LOCAL begin anon types 6822746 */
+	  if (TYPE_MAIN_DECL (type) == TYPE_MAIN_DECL (entity))
+	    break;
+	  /* APPLE LOCAL end anon types 6822746 */
 	  if (TYPE_IDENTIFIER (type) == TYPE_IDENTIFIER (entity)
 	      && TYPE_CONTEXT (type) == TYPE_CONTEXT (entity))
 	    ++discriminator;
diff --git a/llvm-gcc-4.2/gcc/objc/ChangeLog.apple b/llvm-gcc-4.2/gcc/objc/ChangeLog.apple
index 0f96f9b..59e45fd 100644
--- a/llvm-gcc-4.2/gcc/objc/ChangeLog.apple
+++ b/llvm-gcc-4.2/gcc/objc/ChangeLog.apple
@@ -1,3 +1,20 @@
+2009-05-06  Fariborz Jahanian <fjahanian@apple.com>
+
+        Radar 6083666
+	* objc-act.c (objc_build_property_reference_expr): Never
+	issue diagnostics on use of an 'ivar' with property type
+        mismatch. Issue warning in all other cases and only in 
+        legitimate property/user declared type mismatches.
+        (objc_build_property_reference_expr): Do not issue any
+	warning or error when property is more specialized than
+        its user declared accessor. 
+
+2009-04-24  Fariborz Jahanian <fjahanian@apple.com>
+
+        Radar 6825962
+	* objc-act.c (objc_declare_property_impl): Issue property in
+	super class diagnostic even if explicitly asked for.
+
 2009-04-20 Fariborz Jahanian <fjahanian@apple.com> 
         Radar 6803342
         * objc-act.c (generate_objc_image_info): Set the imfo_info
diff --git a/llvm-gcc-4.2/gcc/objc/objc-act.c b/llvm-gcc-4.2/gcc/objc/objc-act.c
index d260cfa..7ca066f 100644
--- a/llvm-gcc-4.2/gcc/objc/objc-act.c
+++ b/llvm-gcc-4.2/gcc/objc/objc-act.c
@@ -1689,6 +1689,8 @@
   tree rtype;
   tree prop, prop_type, res;
   bool receiver_is_class;
+  /* APPLE LOCAL radar 6083666 */
+  tree ivar;
 
   if (component == error_mark_node || component == NULL_TREE
       || TREE_CODE (component) != IDENTIFIER_NODE)
@@ -1703,14 +1705,16 @@
   if (res == NULL_TREE || res == error_mark_node)
     return res;
 
-  prop_type = NULL_TREE;
+  /* APPLE LOCAL radar 6083666 */
+  prop_type = ivar = NULL_TREE;
   /* APPLE LOCAL begin objc2 5512183 */
   if (interface_type && !receiver_is_class)
   /* APPLE LOCAL end objc2 5512183 */
     {
       /* type of the expression is either the property type or, if no property declared,
 	 then ivar type used in receiver.ivar expression. */
-      tree ivar = nested_ivar_lookup (interface_type, component);
+      /* APPLE LOCAL radar 6083666 */
+      ivar = nested_ivar_lookup (interface_type, component);
       if (ivar)
 	prop_type = TREE_TYPE (ivar);
       else
@@ -1767,11 +1771,14 @@
 #endif
           comparison_result = comptypes (prop_type, property_type) != 1;
       }
-      if (prop_type && comparison_result)
-	error ("type of accessor does not match the type of property %qs",
-	       IDENTIFIER_POINTER (PROPERTY_NAME (prop)));
+      /* APPLE LOCAL begin radar 6083666 */
+      if (!ivar && prop_type && comparison_result
+          && !objc_compare_types(property_type, prop_type, -6, NULL_TREE, NULL))
+	warning (0, "type of accessor does not match the type of property %qs",
+	        IDENTIFIER_POINTER (PROPERTY_NAME (prop)));
       else
-	prop_type = property_type;
+        prop_type = property_type;
+      /* APPLE LOCAL end radar 6083666 */
       /* APPLE LOCAL end radar 6029577 */
     }
   /* APPLE LOCAL end objc2 5512183 */
@@ -17082,10 +17089,14 @@
 	      getter_decl = lookup_method (CLASS_NST_METHODS (class), prop_name);
 	      if (getter_decl)
 	    	{
-	          if (comptypes (type, TREE_VALUE (TREE_TYPE (getter_decl))) != 1)
+                  /* APPLE LOCAL begin radar 6083666 */
+                  tree getter_type = TREE_VALUE (TREE_TYPE (getter_decl));
+	          if ((comptypes (type, getter_type) != 1)
+                      && !objc_compare_types (type, getter_type, -6, NULL_TREE, NULL))
 		    /* APPLE LOCAL radar 4815054 */
-	            error ("type of accessor does not match the type of property %qs",
-		           IDENTIFIER_POINTER (prop_name));
+	            warning (0, "type of accessor does not match the type of property %qs",
+		             IDENTIFIER_POINTER (prop_name));
+                  /* APPLE LOCAL end radar 6083666 */
 		  if (METHOD_SEL_ARGS (getter_decl) != NULL_TREE)
 		    error ("accessor %<%c%s%> cannot have any argument", 
 		           '-', IDENTIFIER_POINTER (prop_name));	
@@ -20275,20 +20286,19 @@
                       /* APPLE LOCAL begin radar 6029624 */
                       tree property_type = TREE_TYPE (property_decl);
 		      bool comparison_result;
-                      /* APPLE LOCAL begin radar 5435299 */
-                      if (flag_new_property_ivar_synthesis && flag_objc_abi == 2 && 
-			  !TREE_PURPOSE (chain)) {
+                      /* APPLE LOCAL begin radar 5435299  - radar 6825962 */
+                      if (flag_new_property_ivar_synthesis && flag_objc_abi == 2) {
                         /* In ObjC2 abi, it is illegal when a @synthesize with no named ivar
                            does not have a matching ivar in its class but some superclass ivar
                            already has the desired name */
                         tree record = CLASS_STATIC_TEMPLATE (class);
                         if (record && record != DECL_CONTEXT (ivar_decl))
-                          error ("property %qs attempting to use ivar %qs in super class %qs",
+                          error ("property %qs attempting to use ivar %qs declared in super class of %qs",
                                  IDENTIFIER_POINTER (property_name),
                                  IDENTIFIER_POINTER (ivar_name),
                                  IDENTIFIER_POINTER (OBJC_TYPE_NAME (record)));
                       }
-                      /* APPLE LOCAL end radar 5435299 */
+                      /* APPLE LOCAL end radar 5435299  - radar 6825962 */
 		      /* APPLE LOCAL begin radar 5389292 */
 #ifdef OBJCPLUS
                       if (TREE_CODE (property_type) == REFERENCE_TYPE)
diff --git a/llvm-gcc-4.2/gcc/testsuite/ChangeLog.apple b/llvm-gcc-4.2/gcc/testsuite/ChangeLog.apple
index dd47d84..166f9c1 100644
--- a/llvm-gcc-4.2/gcc/testsuite/ChangeLog.apple
+++ b/llvm-gcc-4.2/gcc/testsuite/ChangeLog.apple
@@ -1,3 +1,15 @@
+2009-05-06  Fariborz Jahanian <fjahanian@apple.com>
+
+	Radar 6083666
+	* objc.dg/property-15.m: Modified
+	* objc.dg/property-16.m: New
+
+2009-04-24  Fariborz Jahanian <fjahanian@apple.com>
+
+	Radar 6825962
+	* property-synthesize-ivar-6.m : Modified.
+	* optional-property.m: Modified.
+
 2009-04-20  Fariborz Jahanian <fjahanian@apple.com>
 
         Radar 6803242
diff --git a/llvm-gcc-4.2/gcc/testsuite/g++.apple/anon-1.C b/llvm-gcc-4.2/gcc/testsuite/g++.apple/anon-1.C
new file mode 100644
index 0000000..3e4ae7d
--- /dev/null
+++ b/llvm-gcc-4.2/gcc/testsuite/g++.apple/anon-1.C
@@ -0,0 +1,15 @@
+/* APPLE LOCAL file anon types 6822746 */
+/* dg-do compile */
+
+class C {
+public:
+  C();
+  C(const C& o);
+};
+
+void foo() {
+  typedef struct {
+    C m;
+  } T;
+  T l[4];
+}
diff --git a/llvm-gcc-4.2/gcc/testsuite/gcc.apple/weak.c b/llvm-gcc-4.2/gcc/testsuite/gcc.apple/weak.c
new file mode 100644
index 0000000..aa6c1c6
--- /dev/null
+++ b/llvm-gcc-4.2/gcc/testsuite/gcc.apple/weak.c
@@ -0,0 +1,31 @@
+/* APPLE LOCAL file weak variables 6822086 */
+/* { dg-do run { target "i?86-*-darwin*" } } */
+/* { dg-options "-O2 -m32" } */
+extern int i __attribute__((weak));
+
+double sin(double);
+
+int j;
+
+void foo(int j);
+double ed;
+
+main() {
+  int l;
+  double d;
+  for (l=0; l < 100; ++l) {
+    if (&i)
+      j = i;
+    else
+      j = 0;
+    d += sin(j);
+  }
+  ed = d;
+  return 0;
+}
+
+/* Hide: void foo(int j) { } from the optimizer. */
+asm(".globl _foo");
+asm("_foo: ret");
+asm(".globl _i");
+asm(".set _i, 0");
diff --git a/llvm-gcc-4.2/gcc/testsuite/objc.dg/property-16.m b/llvm-gcc-4.2/gcc/testsuite/objc.dg/property-16.m
new file mode 100644
index 0000000..1176d5b
--- /dev/null
+++ b/llvm-gcc-4.2/gcc/testsuite/objc.dg/property-16.m
@@ -0,0 +1,39 @@
+/* APPLE LOCAL file radar 6083666 */
+/* Test to check that 1) no warning/error is issued when an 'ivar' which has
+   a matching name with property has a type mismatch with that property. */
+/* { dg-options "-mmacosx-version-min=10.5" { target powerpc*-*-darwin* i?86*-*-darwin* } } */
+/* { dg-do compile } */
+
+@interface NSArray @end
+
+@interface NSMutableArray : NSArray
+@end
+
+@interface Class1 
+{
+ NSMutableArray* pieces;
+ double* unrelated;
+}
+
+@property (readonly) NSArray* pieces;
+@property (readonly) NSArray* unrelated;
+@property (readonly) NSMutableArray* prop_user_getter;
+
+@end
+
+@interface Class2  {
+ Class1* container;
+}
+
+@end
+
+@implementation Class2
+
+- (void) lastPiece
+{
+ container.pieces;
+ container.unrelated;
+ container.prop_user_getter;
+}
+
+@end
diff --git a/llvm-gcc-4.2/gcc/tree-eh.c b/llvm-gcc-4.2/gcc/tree-eh.c
index cb5722d..4742936 100644
--- a/llvm-gcc-4.2/gcc/tree-eh.c
+++ b/llvm-gcc-4.2/gcc/tree-eh.c
@@ -2015,6 +2015,14 @@
 	return true;
       return false;
 
+      /* APPLE LOCAL begin weak variables 6822086 */
+    case VAR_DECL:
+      /* Assume that weak variables may trap.  */
+      if (DECL_WEAK (expr))
+	return true;
+      return false;
+      /* APPLE LOCAL end weak variables 6822086 */
+
     default:
       /* Any floating arithmetic may trap.  */
       if (fp_operation && flag_trapping_math)
diff --git a/llvm-gcc-4.2/gcc/version.c b/llvm-gcc-4.2/gcc/version.c
index 73af315..c29b5e4 100644
--- a/llvm-gcc-4.2/gcc/version.c
+++ b/llvm-gcc-4.2/gcc/version.c
@@ -11,12 +11,12 @@
 /* APPLE LOCAL begin Apple version */
 #ifdef ENABLE_LLVM
 #ifdef LLVM_VERSION_INFO
-#define VERSUFFIX " (Based on Apple Inc. build 5645) (LLVM build " LLVM_VERSION_INFO ")"
+#define VERSUFFIX " (Based on Apple Inc. build 5646) (LLVM build " LLVM_VERSION_INFO ")"
 #else
-#define VERSUFFIX " (Based on Apple Inc. build 5645) (LLVM build)"
+#define VERSUFFIX " (Based on Apple Inc. build 5646) (LLVM build)"
 #endif
 #else
-#define VERSUFFIX " (Based on Apple Inc. build 5645)"
+#define VERSUFFIX " (Based on Apple Inc. build 5646)"
 #endif
 /* APPLE LOCAL end Apple version */