[llvm-commits] [llvm-gcc-4.0] r42614 - in /llvm-gcc-4.0/trunk/gcc: c-common.h llvm-backend.cpp objc/objc-act.c stub-objc.c
Bill Wendling
isanbard at gmail.com
Thu Oct 4 15:15:58 PDT 2007
Author: void
Date: Thu Oct 4 17:15:58 2007
New Revision: 42614
URL: http://llvm.org/viewvc/llvm-project?rev=42614&view=rev
Log:
rdar://5476262 - Try to lookup the name of the global decl before creating a new
one.
Modified:
llvm-gcc-4.0/trunk/gcc/c-common.h
llvm-gcc-4.0/trunk/gcc/llvm-backend.cpp
llvm-gcc-4.0/trunk/gcc/objc/objc-act.c
llvm-gcc-4.0/trunk/gcc/stub-objc.c
Modified: llvm-gcc-4.0/trunk/gcc/c-common.h
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.0/trunk/gcc/c-common.h?rev=42614&r1=42613&r2=42614&view=diff
==============================================================================
--- llvm-gcc-4.0/trunk/gcc/c-common.h (original)
+++ llvm-gcc-4.0/trunk/gcc/c-common.h Thu Oct 4 17:15:58 2007
@@ -1139,12 +1139,6 @@
extern void objc_remove_weak_read (tree*);
/* APPLE LOCAL end radar 4426814 */
-/* APPLE LOCAL begin - LLVM radar 5476262 */
-#ifdef ENABLE_LLVM
-extern bool objc_is_protocol_reference (const char *name);
-#endif
-/* APPLE LOCAL end - LLVM radar 5476262 */
-
/* APPLE LOCAL begin C* language */
extern void objc_set_method_opt (int);
void objc_finish_foreach_loop (location_t, tree, tree, tree, tree);
Modified: llvm-gcc-4.0/trunk/gcc/llvm-backend.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.0/trunk/gcc/llvm-backend.cpp?rev=42614&r1=42613&r2=42614&view=diff
==============================================================================
--- llvm-gcc-4.0/trunk/gcc/llvm-backend.cpp (original)
+++ llvm-gcc-4.0/trunk/gcc/llvm-backend.cpp Thu Oct 4 17:15:58 2007
@@ -66,7 +66,6 @@
#include "function.h"
#include "tree-inline.h"
#include "langhooks.h"
-#include "c-common.h"
}
// Non-zero if bytecode from PCH is successfully read.
@@ -1061,14 +1060,6 @@
// being created.
GlobalVariable *GVE = TheModule->getGlobalVariable(Name);
- // And Objective-C "@protocol" will create a decl for the
- // protocol metadata and then when the protocol is
- // referenced. However, protocols have file-scope, so they
- // aren't found in the GlobalVariable list unless we look at
- // non-extern globals as well.
- if (!GVE && c_dialect_objc() && objc_is_protocol_reference(Name))
- GVE = TheModule->getGlobalVariable(Name, true);
-
if (GVE == 0) {
GV = new GlobalVariable(Ty, false, GlobalValue::ExternalLinkage,0,
Name, TheModule);
Modified: llvm-gcc-4.0/trunk/gcc/objc/objc-act.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.0/trunk/gcc/objc/objc-act.c?rev=42614&r1=42613&r2=42614&view=diff
==============================================================================
--- llvm-gcc-4.0/trunk/gcc/objc/objc-act.c (original)
+++ llvm-gcc-4.0/trunk/gcc/objc/objc-act.c Thu Oct 4 17:15:58 2007
@@ -11867,29 +11867,21 @@
tree decl = TREE_PURPOSE (chain);
gcc_assert (TREE_CODE (expr) == PROTOCOL_INTERFACE_TYPE);
/* APPLE LOCAL begin radar 4695109 */
- sprintf (string, "_OBJC_PROTOCOL_$_%s",
+ /* APPLE LOCAL begin - LLVM radar 5476262 */
+ sprintf (string, "L_OBJC_PROTOCOL_$_%s",
IDENTIFIER_POINTER (PROTOCOL_NAME (expr)));
- expr = start_var_decl (objc_v2_protocol_template, string);
+#ifdef ENABLE_LLVM
+ expr = lookup_name (get_identifier(string));
+ if (expr == NULL_TREE)
+#endif
+ expr = start_var_decl (objc_v2_protocol_template, &string[1]);
+ /* APPLE LOCAL end - LLVM radar 5476262 */
/* APPLE LOCAL end radar 4695109 */
expr = convert (objc_protocol_type, build_fold_addr_expr (expr));
finish_var_decl (decl, expr);
}
}
-/* APPLE LOCAL begin - LLVM radar 5476262 */
-#ifdef ENABLE_LLVM
-/* This routine returns true if the name is the same as a protocol
- reference name. */
-
-bool
-objc_is_protocol_reference (const char *name)
-{
- return flag_objc_abi == 2 && strlen (name) > 19 &&
- strncmp (name, "\01L_OBJC_PROTOCOL_$_", 19) == 0;
-}
-#endif
-/* APPLE LOCAL end - LLVM radar 5476262 */
-
/* This routine builds the protocol_reference_chain for each protocol name used
@protocol(MyProtocol) expression. IDENT is current protocol name. */
@@ -13402,7 +13394,7 @@
/* Declare variable which holds 'struct protocol_t' meta data. */
/* APPLE LOCAL begin radar 4695109 */
-/* poniter to protocol metadata in new ABI protocol is now generated
+/* pointer to protocol metadata in new ABI protocol is now generated
like the old abi. */
static void
build_v2_protocol_reference (tree p)
@@ -13415,6 +13407,9 @@
proto_name = synth_id_with_class_suffix ("_OBJC_PROTOCOL_$", p);
decl = start_var_decl (objc_v2_protocol_template, proto_name);
PROTOCOL_V2_FORWARD_DECL (p) = decl;
+ /* APPLE LOCAL begin - LLVM radar 5476262 */
+ pushdecl_top_level(decl);
+ /* APPLE LOCAL end - LLVM radar 5476262 */
}
/* APPLE LOCAL end radar 4695109 */
Modified: llvm-gcc-4.0/trunk/gcc/stub-objc.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.0/trunk/gcc/stub-objc.c?rev=42614&r1=42613&r2=42614&view=diff
==============================================================================
--- llvm-gcc-4.0/trunk/gcc/stub-objc.c (original)
+++ llvm-gcc-4.0/trunk/gcc/stub-objc.c Thu Oct 4 17:15:58 2007
@@ -548,13 +548,3 @@
return false;
}
/* APPLE LOCAL end radar 4985544 */
-
-/* APPLE LOCAL begin - LLVM radar 5476262 */
-#ifdef ENABLE_LLVM
-bool
-objc_is_protocol_reference (const char * ARG_UNUSED(name))
-{
- return false;
-}
-#endif
-/* APPLE LOCAL end - LLVM radar 5476262 */
More information about the llvm-commits
mailing list