[llvm-commits] [llvm-gcc-4.2] r54202 - in /llvm-gcc-4.2/trunk/gcc: c-common.c cp/decl2.c

Bill Wendling isanbard at gmail.com
Tue Jul 29 23:31:14 PDT 2008


Author: void
Date: Wed Jul 30 01:31:14 2008
New Revision: 54202

URL: http://llvm.org/viewvc/llvm-project?rev=54202&view=rev
Log:
Merges from Apple's GCC 4.2 r148430

Modified:
    llvm-gcc-4.2/trunk/gcc/c-common.c
    llvm-gcc-4.2/trunk/gcc/cp/decl2.c

Modified: llvm-gcc-4.2/trunk/gcc/c-common.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/c-common.c?rev=54202&r1=54201&r2=54202&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/c-common.c (original)
+++ llvm-gcc-4.2/trunk/gcc/c-common.c Wed Jul 30 01:31:14 2008
@@ -699,7 +699,8 @@
 			      handle_section_attribute },
   { "aligned",                0, 1, false, false, false,
 			      handle_aligned_attribute },
-  { "weak",                   0, 0, true,  false, false,
+  /* APPLE LOCAL weak types 5954418 */
+  { "weak",                   0, 0, false, false, false,
 			      handle_weak_attribute },
   { "alias",                  1, 1, true,  false, false,
 			      handle_alias_attribute },
@@ -2536,8 +2537,11 @@
 pointer_int_sum (enum tree_code resultcode, tree ptrop, tree intop)
 {
   tree size_exp, ret;
-  /* LLVM LOCAL */
+  /* LLVM LOCAL begin */
+#ifdef ENABLE_LLVM
   bool size_set = 0;
+#endif
+  /* LLVM LOCAL end */
 
   /* The result is a pointer of the same type that is being added.  */
 
@@ -2561,14 +2565,21 @@
 	pedwarn ("pointer to member function used in arithmetic");
       size_exp = integer_one_node;
     }
+  else
   /* LLVM LOCAL begin */
-  else {
-    size_set = 1;
+#ifdef ENABLE_LLVM
+    {
+      size_set = 1;
+#endif
+  /* LLVM LOCAL end */
+
     size_exp = size_in_bytes (TREE_TYPE (result_type));
-  }
 
-  /* In LLVM we want to represent this as &P[i], not as P+i*sizeof(*P). */
+  /* LLVM LOCAL begin */
 #ifdef ENABLE_LLVM
+    }
+
+  /* In LLVM we want to represent this as &P[i], not as P+i*sizeof(*P). */
   /* Convert the pointer to char* if it is a pointer to a zero sized object. */
   if (!size_set)
     ptrop = convert(build_pointer_type(char_type_node), ptrop);
@@ -5114,6 +5125,13 @@
   if (TREE_CODE (*node) == FUNCTION_DECL
       || TREE_CODE (*node) == VAR_DECL)
     declare_weak (*node);
+  /* APPLE LOCAL begin weak types 5954418 */
+  else if (! targetm.cxx.class_data_always_comdat ()
+	   && TREE_CODE (*node) == RECORD_TYPE)
+    {
+      /* Leave on the type for the C++ front end */
+    }
+  /* APPLE LOCAL end weak types 5954418 */
   else
     warning (OPT_Wattributes, "%qE attribute ignored", name);
     	
@@ -7123,7 +7141,11 @@
 /* ??? This should be in defaults.h or a CW asm specific header.  */
 #ifndef TARGET_IASM_OP_CONSTRAINT
 /* LLVM LOCAL begin */
+#ifdef ENABLE_LLVM
 #define TARGET_IASM_OP_CONSTRAINT
+#else
+#define TARGET_IASM_OP_CONSTRAINT {}
+#endif
 /* LLVM LOCAL end */
 #endif
 
@@ -7205,7 +7227,9 @@
   const struct iasm_op_constraint db[] = {
     TARGET_IASM_OP_CONSTRAINT
     /* LLVM LOCAL begin */
+#ifdef ENABLE_LLVM
     { "", 0, "" }
+#endif
     /* LLVM LOCAL end */
   };
   struct iasm_op_constraint key;
@@ -7219,7 +7243,11 @@
       size_t i;
       once = 1;
       /* LLVM LOCAL begin */
+#ifdef ENABLE_LLVM
       for (i=0; i < sizeof (db) / sizeof(db[0]) - 2; ++i)
+#else
+      for (i=0; i < sizeof (db) / sizeof(db[0]) - 1; ++i)
+#endif
       /* LLVM LOCAL end */
 	gcc_assert (iasm_op_comp (&db[i+1], &db[i]) >= 0);
     }
@@ -7231,7 +7259,11 @@
   TARGET_IASM_REORDER_ARG(opcode, key.argnum, num_args, argnum);
 
   /* LLVM LOCAL begin */
+#ifdef ENABLE_LLVM
   r = bsearch (&key, db, sizeof (db) / sizeof (db[0]) - 1, sizeof (db[0]), iasm_op_comp);
+#else
+  r = bsearch (&key, db, sizeof (db) / sizeof (db[0]), sizeof (db[0]), iasm_op_comp);
+#endif
   /* LLVM LOCAL end */
 
   IASM_SYNTH_CONSTRAINTS(r, argnum, num_args, db);
@@ -7562,7 +7594,7 @@
   const char **clobbers;
   int num;
 
-#if defined(TARGET_IASM_EXTRA_CLOBBERS) && defined(ENABLE_CHECKING)
+#ifdef ENABLE_CHECKING
   /* Ensure that the table is sorted. */
   static int once;
   if (once == 0)
@@ -8209,7 +8241,9 @@
 	  && TREE_STATIC (arg)
 /* APPLE LOCAL begin LLVM */
 /* DECL_RTL does not get set for LLVM */
-/*	  && MEM_P (DECL_RTL (arg))*/
+#ifndef ENABLE_LLVM
+	  && MEM_P (DECL_RTL (arg))
+#endif
          )
 /* APPLE LOCAL end LLVM */
 	{
@@ -8440,7 +8474,7 @@
 {
 /* LLVM LOCAL begin */
 /* Unused variables resulting from code change below. */
-#if 1
+#ifdef ENABLE_LLVM
   tree stmt, label;
 #else
    tree sexpr;
@@ -8460,9 +8494,8 @@
 
   iasm_buffer[0] = '\0';
   label = iasm_define_label (labid);
-/* LLVM LOCAL begin */
-#if 1
-/* LLVM LOCAL end */
+/* LLVM LOCAL */
+#ifdef ENABLE_LLVM
   /* Ideally I'd like to do this, but, it moves the label in:
 
 	nop

Modified: llvm-gcc-4.2/trunk/gcc/cp/decl2.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/cp/decl2.c?rev=54202&r1=54201&r2=54202&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/cp/decl2.c (original)
+++ llvm-gcc-4.2/trunk/gcc/cp/decl2.c Wed Jul 30 01:31:14 2008
@@ -53,8 +53,11 @@
 #include "intl.h"
 /* APPLE LOCAL elide global inits 3814991 */
 #include "tree-iterator.h"
-/* LLVM LOCAL */
+/* LLVM LOCAL begin */
+#ifdef ENABLE_LLVM
 #include "llvm.h"
+#endif
+/* LLVM LOCAL end */
 
 extern cpp_reader *parse_in;
 
@@ -1879,12 +1882,9 @@
 	int subvis = type_visibility (ftype);
 
 	if (subvis == VISIBILITY_ANON)
-	  {
-	    if (!in_main_input_context ())
-	      warning (0, "\
+	  warning (0, "\
 %qT has a field %qD whose type uses the anonymous namespace",
 		   type, t);
-	  }
 	else if (IS_AGGR_TYPE (ftype)
 		 && vis < VISIBILITY_HIDDEN
 		 && subvis >= VISIBILITY_HIDDEN)
@@ -1899,12 +1899,9 @@
       int subvis = type_visibility (TREE_TYPE (t));
 
       if (subvis == VISIBILITY_ANON)
-        {
-	  if (!in_main_input_context())
-	    warning (0, "\
+	warning (0, "\
 %qT has a base %qT whose type uses the anonymous namespace",
 		 type, TREE_TYPE (t));
-	}
       else if (vis < VISIBILITY_HIDDEN
 	       && subvis >= VISIBILITY_HIDDEN)
 	warning (OPT_Wattributes, "\
@@ -1913,6 +1910,27 @@
     }
 }
 
+/* APPLE LOCAL begin weak types 5954418 */
+static bool
+typeinfo_comdat (tree type)
+{
+  tree binfo, base_binfo;
+  int j;
+
+  if (lookup_attribute ("weak", TYPE_ATTRIBUTES (type)))
+    return true;
+  
+  for (binfo = TYPE_BINFO (type), j = 0;
+       BINFO_BASE_ITERATE (binfo, j, base_binfo); ++j)
+    {
+      if (typeinfo_comdat (BINFO_TYPE (base_binfo)))
+	return true;
+    }
+
+  return false;
+}
+/* APPLE LOCAL end weak types 5954418 */
+
 /* DECL is a FUNCTION_DECL or VAR_DECL.  If the object file linkage
    for DECL has not already been determined, do so now by setting
    DECL_EXTERNAL, DECL_COMDAT and other related flags.  Until this
@@ -2109,7 +2127,10 @@
 		{
 		  comdat_p = (targetm.cxx.class_data_always_comdat ()
 			      || (CLASSTYPE_KEY_METHOD (type)
-				  && DECL_DECLARED_INLINE_P (CLASSTYPE_KEY_METHOD (type))));
+				  /* APPLE LOCAL begin weak types 5954418 */
+				  && DECL_DECLARED_INLINE_P (CLASSTYPE_KEY_METHOD (type)))
+			      || typeinfo_comdat (type));
+		  /* APPLE LOCAL end weak types 5954418 */
 		  mark_needed (decl);
 		  if (!flag_weak)
 		    {





More information about the llvm-commits mailing list