[llvm-commits] [llvm-gcc-4.2] r62484 - in /llvm-gcc-4.2/trunk: config/darwin10.h gcc/c-decl.c gcc/c-tree.h gcc/cp/cp-tree.h gcc/cp/decl.c gcc/cp/decl.h gcc/cp/parser.c gcc/cp/typeck.c gcc/dwarf2.h gcc/ipa-inline.c gcc/langhooks.c gcc/langhooks.h gcc/objc/ChangeLog.apple gcc/objc/objc-act.c gcc/objc/objc-lang.c gcc/objcp/objcp-decl.h gcc/objcp/objcp-lang.c
Bill Wendling
isanbard at gmail.com
Sun Jan 18 18:32:07 PST 2009
Author: void
Date: Sun Jan 18 20:32:07 2009
New Revision: 62484
URL: http://llvm.org/viewvc/llvm-project?rev=62484&view=rev
Log:
Many many blocks fixes.
Added:
llvm-gcc-4.2/trunk/config/darwin10.h
Modified:
llvm-gcc-4.2/trunk/gcc/c-decl.c
llvm-gcc-4.2/trunk/gcc/c-tree.h
llvm-gcc-4.2/trunk/gcc/cp/cp-tree.h
llvm-gcc-4.2/trunk/gcc/cp/decl.c
llvm-gcc-4.2/trunk/gcc/cp/decl.h
llvm-gcc-4.2/trunk/gcc/cp/parser.c
llvm-gcc-4.2/trunk/gcc/cp/typeck.c
llvm-gcc-4.2/trunk/gcc/dwarf2.h
llvm-gcc-4.2/trunk/gcc/ipa-inline.c
llvm-gcc-4.2/trunk/gcc/langhooks.c
llvm-gcc-4.2/trunk/gcc/langhooks.h
llvm-gcc-4.2/trunk/gcc/objc/ChangeLog.apple
llvm-gcc-4.2/trunk/gcc/objc/objc-act.c
llvm-gcc-4.2/trunk/gcc/objc/objc-lang.c
llvm-gcc-4.2/trunk/gcc/objcp/objcp-decl.h
llvm-gcc-4.2/trunk/gcc/objcp/objcp-lang.c
Added: llvm-gcc-4.2/trunk/config/darwin10.h
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/config/darwin10.h?rev=62484&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/config/darwin10.h (added)
+++ llvm-gcc-4.2/trunk/config/darwin10.h Sun Jan 18 20:32:07 2009
@@ -0,0 +1,2 @@
+/* APPLE LOCAL .file/.loc 6349436 */
+/* #define DWARF2_ASM_LINE_DEBUG_INFO 1 */
Modified: llvm-gcc-4.2/trunk/gcc/c-decl.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/c-decl.c?rev=62484&r1=62483&r2=62484&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/c-decl.c (original)
+++ llvm-gcc-4.2/trunk/gcc/c-decl.c Sun Jan 18 20:32:07 2009
@@ -71,6 +71,8 @@
enum decl_context
{ NORMAL, /* Ordinary declaration */
FUNCDEF, /* Function definition */
+ /* APPLE LOCAL blocks 6339747 */
+ BLOCKDEF, /* Block literal declaration */
PARM, /* Declaration of parm before function body */
FIELD, /* Declaration inside struct or union */
TYPENAME}; /* Typename (inside cast or sizeof) */
@@ -3285,6 +3287,27 @@
}
}
+/* APPLE LOCAL begin blocks 6339747 */
+/* Decode a block literal type, such as "int **", returning a ...FUNCTION_DECL node. */
+
+tree
+grokblockdecl (struct c_declspecs *specs, struct c_declarator *declarator)
+{
+ tree decl;
+ tree attrs = specs->attrs;
+
+ specs->attrs = NULL_TREE;
+
+ decl = grokdeclarator (declarator, specs, BLOCKDEF,
+ false, NULL);
+
+ /* Apply attributes. */
+ decl_attributes (&decl, attrs, 0);
+
+ return decl;
+}
+/* APPLE LOCAL end blocks 6339747 */
+
/* Decode a "typename", such as "int **", returning a ..._TYPE node. */
tree
@@ -5172,6 +5195,41 @@
type = error_mark_node;
}
+ /* APPLE LOCAL begin blocks 6339747 */
+ if (decl_context == BLOCKDEF)
+ {
+ tree decl;
+
+ if (type == error_mark_node)
+ return error_mark_node;
+
+ if (TREE_CODE (type) != FUNCTION_TYPE)
+ {
+ tree arg_types;
+
+ if (TREE_CODE (type) == ARRAY_TYPE)
+ {
+ error ("block declared as returning an array");
+ return error_mark_node;
+ }
+
+ arg_info = XOBNEW (&parser_obstack, struct c_arg_info);
+ arg_info->parms = 0;
+ arg_info->tags = 0;
+ arg_info->types = 0;
+ arg_info->others = 0;
+ arg_info->pending_sizes = 0;
+ arg_info->had_vla_unspec = 0;
+ arg_types = grokparms (arg_info, false);
+ type_quals = TYPE_UNQUALIFIED;
+ type = build_function_type (type, arg_types);
+ }
+ decl = build_decl (FUNCTION_DECL, NULL_TREE, type);
+ DECL_ARGUMENTS (decl) = arg_info ? arg_info->parms : NULL_TREE;
+ return decl;
+ }
+ /* APPLE LOCAL end blocks 6339747 */
+
/* If this is declaring a typedef name, return a TYPE_DECL. */
if (storage_class == csc_typedef)
@@ -8343,8 +8401,8 @@
block_build_prologue
- This routine builds the declarations for the
variables referenced in the block; as in:
- int *y = _self->y;
- int x = _self->x;
+ int *y = .block_descriptor->y;
+ int x = .block_descriptor->x;
The decl_expr declaration for each initialization is enterred at the
beginning of the helper function's statement-list which is passed
@@ -8354,7 +8412,8 @@
block_build_prologue (struct block_sema_info *block_impl)
{
tree chain;
- tree self_parm = lookup_name (get_identifier ("_self"));
+ /* APPLE LOCAL radar 6404979 */
+ tree self_parm = lookup_name (get_identifier (".block_descriptor"));
gcc_assert (self_parm);
for (chain = block_impl->block_ref_decl_list; chain;
Modified: llvm-gcc-4.2/trunk/gcc/c-tree.h
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/c-tree.h?rev=62484&r1=62483&r2=62484&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/c-tree.h (original)
+++ llvm-gcc-4.2/trunk/gcc/c-tree.h Sun Jan 18 20:32:07 2009
@@ -478,6 +478,8 @@
extern struct c_arg_info *get_parm_info (bool);
extern tree grokfield (struct c_declarator *, struct c_declspecs *, tree);
extern tree groktypename (struct c_type_name *);
+/* APPLE LOCAL blocks 6339747 */
+extern tree grokblockdecl (struct c_declspecs *, struct c_declarator *);
extern tree grokparm (const struct c_parm *);
extern tree implicitly_declare (tree);
extern void keep_next_level (void);
Modified: llvm-gcc-4.2/trunk/gcc/cp/cp-tree.h
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/cp/cp-tree.h?rev=62484&r1=62483&r2=62484&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/cp/cp-tree.h (original)
+++ llvm-gcc-4.2/trunk/gcc/cp/cp-tree.h Sun Jan 18 20:32:07 2009
@@ -3983,6 +3983,8 @@
extern tree check_tag_decl (cp_decl_specifier_seq *);
extern tree shadow_tag (cp_decl_specifier_seq *);
extern tree groktypename (cp_decl_specifier_seq *, const cp_declarator *);
+/* APPLE LOCAL 6339747 */
+extern tree grokblockdecl (cp_decl_specifier_seq *, const cp_declarator *);
extern tree start_decl (const cp_declarator *, cp_decl_specifier_seq *, int, tree, tree, tree *);
extern void start_decl_1 (tree, bool);
extern void cp_finish_decl (tree, tree, bool, tree, int);
Modified: llvm-gcc-4.2/trunk/gcc/cp/decl.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/cp/decl.c?rev=62484&r1=62483&r2=62484&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/cp/decl.c (original)
+++ llvm-gcc-4.2/trunk/gcc/cp/decl.c Sun Jan 18 20:32:07 2009
@@ -3901,6 +3901,25 @@
return t;
}
+/* APPLE LOCAL begin blocks 6339747 */
+/* Decode a block literal type, such as "int **", returning a ...FUNCTION_DECL node. */
+
+tree
+grokblockdecl (cp_decl_specifier_seq *type_specifiers,
+ const cp_declarator *declarator)
+{
+ tree decl;
+ tree attrs = type_specifiers->attributes;
+
+ type_specifiers->attributes = NULL_TREE;
+
+ decl = grokdeclarator (declarator, type_specifiers, BLOCKDEF, 0, &attrs);
+ if (attrs)
+ cplus_decl_attributes (&decl, attrs, 0);
+ return decl;
+}
+/* APPLE LOCAL end blocks 6339747 */
+
/* Decode a "typename", such as "int **", returning a ..._TYPE node. */
tree
@@ -8694,6 +8713,38 @@
}
}
+ /* APPLE LOCAL begin blocks 6339747 */
+ if (decl_context == BLOCKDEF)
+ {
+ tree decl;
+
+ if (type == error_mark_node)
+ return error_mark_node;
+
+ if (TREE_CODE (type) != FUNCTION_TYPE)
+ {
+ tree t = make_node (FUNCTION_TYPE);
+
+ if (TREE_CODE (type) == ARRAY_TYPE)
+ {
+ error ("block declared as returning an array");
+ return error_mark_node;
+ }
+
+ TYPE_ARG_TYPES (t) = void_list_node;
+ TREE_TYPE (t) = type;
+ type = t;
+ parms = NULL_TREE;
+ }
+
+ if (raises)
+ type = build_exception_variant (type, raises);
+ decl = build_lang_decl (FUNCTION_DECL, NULL_TREE, type);
+ DECL_ARGUMENTS (decl) = parms;
+ return decl;
+ }
+ /* APPLE LOCAL end blocks 6339747 */
+
/* If this is declaring a typedef name, return a TYPE_DECL. */
if (declspecs->specs[(int)ds_typedef] && decl_context != TYPENAME)
{
Modified: llvm-gcc-4.2/trunk/gcc/cp/decl.h
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/cp/decl.h?rev=62484&r1=62483&r2=62484&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/cp/decl.h (original)
+++ llvm-gcc-4.2/trunk/gcc/cp/decl.h Sun Jan 18 20:32:07 2009
@@ -27,6 +27,8 @@
FIELD, /* Declaration inside struct or union */
BITFIELD, /* Likewise but with specified width */
TYPENAME, /* Typename (inside cast or sizeof) */
+ /* APPLE LOCAL blocks 6339747 */
+ BLOCKDEF, /* Declaratin of block literal */
MEMFUNCDEF /* Member function definition */
};
Modified: llvm-gcc-4.2/trunk/gcc/cp/parser.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/cp/parser.c?rev=62484&r1=62483&r2=62484&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/cp/parser.c (original)
+++ llvm-gcc-4.2/trunk/gcc/cp/parser.c Sun Jan 18 20:32:07 2009
@@ -1220,6 +1220,10 @@
typedef enum cp_parser_declarator_kind
{
+ /* APPLE LOCAL begin blocks 6339747 */
+ /* We want a block declarator. */
+ CP_PARSER_DECLARATOR_BLOCK,
+ /* APPLE LOCAL end blocks 6339747 */
/* We want an abstract declarator. */
CP_PARSER_DECLARATOR_ABSTRACT,
/* We want a named declarator. */
@@ -3303,7 +3307,7 @@
__builtin_va_arg ( assignment-expression , type-id )
__builtin_offsetof ( type-id , offsetof-expression )
APPLE LOCAL blocks 6040305 (cf)
- ^ block-literal-expr
+ block-literal-expr
Objective-C++ Extension:
@@ -12417,6 +12421,12 @@
attributes [opt] ptr-operator abstract-declarator [opt]
attributes [opt] direct-abstract-declarator
+ APPLE LOCAL begin blocks 6339747
+ block-declarator:
+ attributes [opt] ptr-operator block-declarator [opt]
+ attributes [opt] direct-block-declarator
+ APPLE LOCAL end blocks 6339747
+
If CTOR_DTOR_OR_CONV_P is not NULL, *CTOR_DTOR_OR_CONV_P is used to
detect constructor, destructor or conversion operators. It is set
to -1 if the declarator is a name, and +1 if it is a
@@ -12540,10 +12550,6 @@
return declarator;
}
-/* APPLE LOCAL begin blocks 6185344 */
-static int parsing_block_return_type;
-/* APPLE LOCAL end blocks 6185344 */
-
/* Parse a direct-declarator or direct-abstract-declarator.
direct-declarator:
@@ -12562,6 +12568,17 @@
direct-abstract-declarator [opt] [ constant-expression [opt] ]
( abstract-declarator )
+ APPLE LOCAL begin blocks 6339747
+ GNU Extensions:
+
+ direct-block-declarator:
+ direct-block-declarator [opt]
+ ( parameter-declaration-clause ) [opt]
+ exception-specification [opt]
+ direct-block-declarator [opt] [ constant-expression [opt] ]
+ ( block-declarator )
+ APPLE LOCAL end blocks 6339747
+
Returns a representation of the declarator. DCL_KIND is
CP_PARSER_DECLARATOR_ABSTRACT, if we are parsing a
direct-abstract-declarator. It is CP_PARSER_DECLARATOR_NAMED, if
@@ -12589,8 +12606,7 @@
{
/* Peek at the next token. */
token = cp_lexer_peek_token (parser->lexer);
- /* APPLE LOCAL radar 6185344 */
- if (!parsing_block_return_type && token->type == CPP_OPEN_PAREN)
+ if (token->type == CPP_OPEN_PAREN)
{
/* This is either a parameter-declaration-clause, or a
parenthesized declarator. When we know we are parsing a
@@ -12679,8 +12695,16 @@
/* Consume the `)'. */
cp_parser_require (parser, CPP_CLOSE_PAREN, "`)'");
- /* Parse the cv-qualifier-seq. */
- cv_quals = cp_parser_cv_qualifier_seq_opt (parser);
+ /* APPLE LOCAL begin blocks 6339747 */
+ if (dcl_kind != BLOCKDEF)
+ {
+ /* Parse the cv-qualifier-seq. */
+ cv_quals = cp_parser_cv_qualifier_seq_opt (parser);
+ }
+ else
+ cv_quals = TYPE_UNQUALIFIED;
+ /* APPLE LOCAL end blocks 6339747 */
+
/* And the exception-specification. */
exception_specification
= cp_parser_exception_specification_opt (parser);
@@ -12780,7 +12804,10 @@
declarator = make_array_declarator (declarator, bounds);
}
- else if (first && dcl_kind != CP_PARSER_DECLARATOR_ABSTRACT)
+ /* APPLE LOCAL begin blocks 6339747 */
+ else if (first && (dcl_kind == CP_PARSER_DECLARATOR_NAMED
+ || dcl_kind == CP_PARSER_DECLARATOR_EITHER))
+ /* APPLE LOCAL end blocks 6339747 */
{
tree qualifying_scope;
tree unqualified_name;
@@ -12941,7 +12968,8 @@
/* For an abstract declarator, we might wind up with nothing at this
point. That's an error; the declarator is not optional. */
- if (!declarator)
+ /* APPLE LOCAL blocks 6339747 */
+ if (!declarator && dcl_kind != CP_PARSER_DECLARATOR_BLOCK)
cp_parser_error (parser, "expected declarator");
/* If we entered a scope, we must exit it now. */
@@ -20876,11 +20904,11 @@
rest_of_decl_compilation (NSConcreteGlobalBlock_decl, 0, 0);
}
}
- /* LLVM LOCAL begin radar 5865221 */
+ /* APPLE LOCAL begin radar 6457359 */
CONSTRUCTOR_APPEND_ELT(impl_v, NULL_TREE,
convert (ptr_type_node,
build_fold_addr_expr (NSConcreteGlobalBlock_decl)));
- /* LLVM LOCAL end radar 5865221 */
+ /* APPLE LOCAL end radar 6457359 */
flags |= BLOCK_IS_GLOBAL;
}
else
@@ -20900,11 +20928,11 @@
rest_of_decl_compilation (NSConcreteStackBlock_decl, 0, 0);
}
}
- /* LLVM LOCAL begin radar 5865221 */
+ /* APPLE LOCAL begin radar 6457359 */
CONSTRUCTOR_APPEND_ELT(impl_v, NULL_TREE,
convert (ptr_type_node,
build_fold_addr_expr (NSConcreteStackBlock_decl)));
- /* LLVM LOCAL end radar 5865221 */
+ /* APPLE LOCAL end radar 6457359 */
}
/* __flags */
@@ -21270,11 +21298,47 @@
pop_function_context ();
}
-/** cp_parser_block_literal_expr - Main routine to process a block literal
- with the syntax of ^arg-list[OPT] block or ^()expression. It synthesizes
- the helper function for later generation and builds the necessary data to
- represent the block literal where it is declared.
-*/
+/* Parse a block-id.
+
+ GNU Extension:
+
+ block-id:
+ type-specifier-seq block-declarator
+
+ Returns the DECL specified or implied. */
+
+static tree
+cp_parser_block_id (cp_parser* parser)
+{
+ cp_decl_specifier_seq type_specifier_seq;
+ cp_declarator *declarator;
+
+ /* Parse the type-specifier-seq. */
+ cp_parser_type_specifier_seq (parser, /*is_condition=*/false,
+ &type_specifier_seq);
+ if (type_specifier_seq.type == error_mark_node)
+ return error_mark_node;
+
+ /* Look for the block-declarator. */
+ declarator
+ = cp_parser_declarator (parser, CP_PARSER_DECLARATOR_BLOCK, NULL,
+ /*parenthesized_p=*/NULL,
+ /*member_p=*/false);
+
+ return grokblockdecl (&type_specifier_seq, declarator);
+}
+
+/* Parse a block-literal-expr.
+
+ GNU Extension:
+
+ block-literal-expr:
+ ^ parameter-declation-clause exception-specification [opt] compound-statement
+ ^ block-id compound-statement
+
+ It synthesizes the helper function for later generation and builds
+ the necessary data to represent the block literal where it is
+ declared. */
static tree
cp_parser_block_literal_expr (cp_parser* parser)
{
@@ -21299,6 +21363,7 @@
tree attributes = NULL_TREE;
/* APPLE LOCAL radar 6169580 */
int context_is_nonstatic_method;
+ tree raises = NULL_TREE;
cp_lexer_consume_token (parser->lexer); /* eat '^' */
@@ -21307,30 +21372,9 @@
attributes = cp_parser_attributes_opt (parser);
/* APPLE LOCAL end radar 6237713 */
- /* APPLE LOCAL begin radar 6185344 */
- /* Parse user declared return type. */
- if (!cp_lexer_next_token_is (parser->lexer, CPP_OPEN_PAREN) &&
- !cp_lexer_next_token_is (parser->lexer, CPP_OPEN_BRACE))
- {
- tree type;
- /* APPLE LOCAL begin radar 6237713 */
- if (attributes)
- {
- warning (0, "attribute before block type is ignored");
- attributes = NULL_TREE;
- }
- /* APPLE LOCAL end radar 6237713 */
- parsing_block_return_type = 1;
- type = cp_parser_type_id (parser);
- parsing_block_return_type = 0;
- if (type != error_mark_node)
- declared_block_return_type = type;
- }
- /* APPLE LOCAL end radar 6185344 */
-
- /* Parse the optional argument list */
if (cp_lexer_next_token_is (parser->lexer, CPP_OPEN_PAREN))
{
+ /* Parse the optional argument list */
cp_lexer_consume_token (parser->lexer);
/* Open the scope to collect parameter decls */
/* push_scope (); */
@@ -21342,15 +21386,35 @@
/* Check for args as it might be NULL due to error. */
if (! args)
{
- /* pop_scope (); */
return error_mark_node;
}
- /* pop_scope (); */
+ raises = cp_parser_exception_specification_opt (parser);
}
-#if 0
- else
- arglist = build_tree_list (NULL_TREE, void_type_node);
-#endif
+ /* APPLE LOCAL begin radar 6185344 */
+ else if (cp_lexer_next_token_is_not (parser->lexer, CPP_OPEN_BRACE))
+ {
+ /* Parse user declared return type. */
+ tree decl;
+
+ /* APPLE LOCAL begin radar 6237713 */
+ if (attributes)
+ {
+ warning (0, "attributes before block type are ignored");
+ attributes = NULL_TREE;
+ }
+ /* APPLE LOCAL end radar 6237713 */
+
+ decl = cp_parser_block_id (parser);
+
+ if (decl && decl != error_mark_node)
+ {
+ arg_type = TYPE_ARG_TYPES (TREE_TYPE (decl));
+ arglist = DECL_ARGUMENTS (decl);
+ raises = TYPE_RAISES_EXCEPTIONS (TREE_TYPE (decl));
+ declared_block_return_type = TREE_TYPE (TREE_TYPE (decl));
+ }
+ }
+ /* APPLE LOCAL end radar 6185344 */
block = begin_block ();
/* APPLE LOCAL begin radar 6169580 */
@@ -21369,32 +21433,10 @@
cur_block->return_type = NULL_TREE;
/* APPLE LOCAL end radar 6185344 */
- if (args)
- {
- /* cur_block->arg_info = args; */
- if (arg_type)
- {
- cur_block->hasPrototype = true;
- /* This is the only way in gcc to know if argument list ends with ... */
- cur_block->isVariadic = args->ellipsis_p;
- }
- else
- {
- /* K&R syle () argument list. */
- cur_block->hasPrototype = false;
- cur_block->isVariadic = true;
- }
- }
- else
- {
- cur_block->hasPrototype = false;
- cur_block->isVariadic = false;
- /* cur_block->arg_info = xcalloc (1, sizeof (struct c_arg_info)); */
- }
-
- /* Must also build hidden parameter _self added to the helper
+ /* Must also build hidden parameter .block_descriptor added to the helper
function, even though we do not know its type yet. */
- self_arg = build_artificial_parm (get_identifier ("_self"), ptr_type_node);
+ /* APPLE LOCAL radar 6404979 */
+ self_arg = build_artificial_parm (get_identifier (".block_descriptor"), ptr_type_node);
/* TREE_CHAIN (self_arg) = cur_block->arg_info->parms; */
TREE_CHAIN (self_arg) = arglist;
@@ -21413,6 +21455,8 @@
? void_type_node : cur_block->return_type),
arg_type);
/* APPLE LOCAL end radar 6185344 */
+ if (raises)
+ ftype = build_exception_variant (ftype, raises);
/* APPLE LOCAL radar 6160536 */
block_helper_function_decl = build_helper_func_decl (build_block_helper_name (unique_count),
ftype);
@@ -21466,7 +21510,7 @@
if (restype == error_mark_node)
return clean_and_exit (block);
- /* Now that we know type of the hidden _self argument, fix its type. */
+ /* Now that we know type of the hidden .block_descriptor argument, fix its type. */
TREE_TYPE (self_arg) = cur_block->block_arg_ptr_type;
DECL_ARG_TYPE (self_arg) = cur_block->block_arg_ptr_type;
@@ -21487,6 +21531,8 @@
not nested and is gimplified in call to finish_function() and return type
of the function must be correct. */
ftype = build_function_type (restype, TREE_CHAIN (arg_type));
+ if (raises)
+ ftype = build_exception_variant (ftype, raises);
/* Declare helper function; as in:
double helper_1(struct block_1 *ii, int z); */
typelist = TYPE_ARG_TYPES (ftype);
@@ -21494,6 +21540,8 @@
typelist = tree_cons (NULL_TREE, cur_block->block_arg_ptr_type,
typelist);
helper_function_type = build_function_type (TREE_TYPE (ftype), typelist);
+ if (raises)
+ helper_function_type = build_exception_variant (helper_function_type, raises);
TREE_TYPE (cur_block->helper_func_decl) = helper_function_type;
finish_function (4);
pop_function_context ();
@@ -21994,8 +22042,8 @@
block_build_prologue
- This routine builds the declarations for the
variables referenced in the block; as in:
- int *y = _self->y;
- int x = _self->x;
+ int *y = .block_descriptor->y;
+ int x = .block_descriptor->x;
The decl_expr declaration for each initialization is enterred at the
beginning of the helper function's statement-list which is passed
@@ -22005,7 +22053,7 @@
block_build_prologue (struct block_sema_info *block_impl)
{
tree chain;
- tree self_parm = lookup_name (get_identifier ("_self"));
+ tree self_parm = lookup_name (get_identifier (".block_descriptor"));
gcc_assert (self_parm);
for (chain = block_impl->block_ref_decl_list; chain;
Modified: llvm-gcc-4.2/trunk/gcc/cp/typeck.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/cp/typeck.c?rev=62484&r1=62483&r2=62484&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/cp/typeck.c (original)
+++ llvm-gcc-4.2/trunk/gcc/cp/typeck.c Sun Jan 18 20:32:07 2009
@@ -239,6 +239,8 @@
x = DECL_ORIGINAL_TYPE (x);
if (x == NULL_TREE)
break;
+ if (x == t)
+ break;
t = x;
}
return cp_build_qualified_type (t, quals);
@@ -2776,12 +2778,16 @@
tree function_ptr_exp;
tree typelist;
tree result;
+ /* APPLE LOCAL radar 6396238 */
+ bool block_ptr_exp_side_effect = TREE_SIDE_EFFECTS (block_ptr_exp);
/* First convert it to 'void *'. */
block_ptr_exp = convert (ptr_type_node, block_ptr_exp);
gcc_assert (generic_block_literal_struct_type);
block_ptr_exp = convert (build_pointer_type (generic_block_literal_struct_type),
block_ptr_exp);
+ if (block_ptr_exp_side_effect)
+ block_ptr_exp = save_expr (block_ptr_exp);
/* BLOCK_PTR_VAR->__FuncPtr */
function_ptr_exp =
Modified: llvm-gcc-4.2/trunk/gcc/dwarf2.h
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/dwarf2.h?rev=62484&r1=62483&r2=62484&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/dwarf2.h (original)
+++ llvm-gcc-4.2/trunk/gcc/dwarf2.h Sun Jan 18 20:32:07 2009
@@ -395,8 +395,12 @@
/* APPLE LOCAL differentiate between arm & thumb. */
/* APPLE LOCAL begin radar 5811943 - Fix type of pointers to blocks */
DW_AT_APPLE_isa = 0x3fe3,
- DW_AT_APPLE_block = 0x3fe4
+ /* APPLE LOCAL begin radar 6386976 */
+ DW_AT_APPLE_block = 0x3fe4,
/* APPLE LOCAL end radar 5811943 - Fix type of pointers to blocks */
+ DW_AT_APPLE_major_runtime_vers = 0x3fe5,
+ DW_AT_APPLE_runtime_class = 0x3fe6
+ /* APPLE LOCAL end radar 6386976 */
};
#define DW_AT_lo_user 0x2000 /* Implementation-defined range start. */
Modified: llvm-gcc-4.2/trunk/gcc/ipa-inline.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/ipa-inline.c?rev=62484&r1=62483&r2=62484&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/ipa-inline.c (original)
+++ llvm-gcc-4.2/trunk/gcc/ipa-inline.c Sun Jan 18 20:32:07 2009
@@ -1149,6 +1149,7 @@
inlined = true;
}
+ /* Now do the automatic inlining. */
if (!flag_really_no_inline)
for (e = node->callees; e; e = e->next_callee)
if (e->callee->local.inlinable
Modified: llvm-gcc-4.2/trunk/gcc/langhooks.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/langhooks.c?rev=62484&r1=62483&r2=62484&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/langhooks.c (original)
+++ llvm-gcc-4.2/trunk/gcc/langhooks.c Sun Jan 18 20:32:07 2009
@@ -621,3 +621,11 @@
return NULL_TREE;
}
/* APPLE LOCAL end radar 6353006 */
+
+/* APPLE LOCAL begin radar 6386976 */
+bool
+lhd_is_runtime_specific_type (tree type ATTRIBUTE_UNUSED)
+{
+ return false;
+}
+/* APPLE LOCAL end radar 6386976 */
Modified: llvm-gcc-4.2/trunk/gcc/langhooks.h
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/langhooks.h?rev=62484&r1=62483&r2=62484&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/langhooks.h (original)
+++ llvm-gcc-4.2/trunk/gcc/langhooks.h Sun Jan 18 20:32:07 2009
@@ -148,6 +148,12 @@
firstprivate variables. */
void (*omp_firstprivatize_type_sizes) (struct gimplify_omp_ctx *, tree);
+ /* APPLE LOCAL begin radar 6386976 */
+ /* Determine whether the type-tree passed in is specific to the
+ language/runtime definitions, e.g. is an Objective-C class... */
+ bool (*is_runtime_specific_type) (tree);
+ /* APPLE LOCAL end radar 6386976 */
+
/* Nonzero if types that are identical are to be hashed so that only
one copy is kept. If a language requires unique types for each
user-specified type, such as Ada, this should be set to TRUE. */
Modified: llvm-gcc-4.2/trunk/gcc/objc/ChangeLog.apple
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/objc/ChangeLog.apple?rev=62484&r1=62483&r2=62484&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/objc/ChangeLog.apple (original)
+++ llvm-gcc-4.2/trunk/gcc/objc/ChangeLog.apple Sun Jan 18 20:32:07 2009
@@ -1,3 +1,9 @@
+2009-01-07 Fariborz Jahanian <fjahanian at apple.com>
+
+ Radar 6379842
+ * objc-act.c (objc_add_property_variable): warn on
+ block property with no 'copy' attribute.
+
2008-11-14 Fariborz Jahanian <fjahanian at apple.com>
Radar 6370136
Modified: llvm-gcc-4.2/trunk/gcc/objc/objc-act.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/objc/objc-act.c?rev=62484&r1=62483&r2=62484&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/objc/objc-act.c (original)
+++ llvm-gcc-4.2/trunk/gcc/objc/objc-act.c Sun Jan 18 20:32:07 2009
@@ -1344,6 +1344,16 @@
/* under -fobjc-gc[-only], a warning should be issued if none of those were specified
AND the object type conforms to <NSCopying>. */
tree ltyp = TREE_TYPE (property_decl);
+ /* APPLE LOCAL begin radar 6379842 */
+ /* under -fobjc-gc-only flag, a warning to be issued if
+ block pointer property does not have 'copy' attribute. */
+ if (flag_objc_gc_only
+ && TREE_CODE (ltyp) == BLOCK_POINTER_TYPE
+ && !property_copy)
+ warning (0, "'copy' attribute must be specified for the block"
+ " property %qs when -fobjc-gc-only is specified",
+ IDENTIFIER_POINTER (PROPERTY_NAME (property_decl)));
+ /* APPLE LOCAL end radar 6379842 */
do
ltyp = TREE_TYPE (ltyp);
while (POINTER_TYPE_P (ltyp));
@@ -3168,10 +3178,18 @@
/* APPLE LOCAL end radar 4869979 */
}
+/* APPLE LOCAL begin deprecated use in deprecated 6425499 */
+static tree fast_lookup_method (int is_class, tree class, tree method_ident);
+/* APPLE LOCAL end deprecated use in deprecated 6425499 */
+
void
/* APPLE LOCAL radar 3803157 - objc attribute */
objc_start_method_definition (tree decl, tree attributes)
{
+ /* APPLE LOCAL begin deprecated use in deprecated 6425499 */
+ tree class;
+ /* APPLE LOCAL end deprecated use in deprecated 6425499 */
+
if (!objc_implementation_context)
fatal_error ("method definition not in @implementation context");
@@ -3218,6 +3236,18 @@
decl,
/* APPLE LOCAL C* language */
objc_inherit_code == CLASS_METHOD_DECL, 0);
+ /* APPLE LOCAL begin deprecated use in deprecated 6425499 */
+ /* We have to copy the TREE_DEPRECATED bit from the interface. */
+ class = lookup_interface (CLASS_NAME (objc_implementation_context));
+ if (class)
+ {
+ tree decl2 = fast_lookup_method (objc_inherit_code == CLASS_METHOD_DECL,
+ class,
+ METHOD_SEL_NAME (decl));
+ if (decl2)
+ TREE_DEPRECATED (decl) = TREE_DEPRECATED (decl2);
+ }
+ /* APPLE LOCAL end deprecated use in deprecated 6425499 */
start_method_def (decl);
/* APPLE LOCAL begin ObjC abi v2 */
@@ -4057,6 +4087,10 @@
{
tree type = TREE_TYPE (decl);
+ /* APPLE LOCAL begin 6393374 */
+ while (TREE_CODE (type) == ARRAY_TYPE)
+ type = TREE_TYPE (type);
+ /* APPLE LOCAL end 6393374 */
if (TREE_CODE (type) != RECORD_TYPE)
return;
if (OBJC_TYPE_NAME (type) && (type = objc_is_class_name (OBJC_TYPE_NAME (type))))
@@ -14876,18 +14910,18 @@
if (!(mth = lookup_method (is_class
? PROTOCOL_OPTIONAL_CLS_METHODS (class)
: PROTOCOL_OPTIONAL_NST_METHODS (class), method)))
- {
- if (is_class)
- {
- TREE_CHAIN (method) = PROTOCOL_OPTIONAL_CLS_METHODS (class);
- PROTOCOL_OPTIONAL_CLS_METHODS (class) = method;
- }
- else
- {
- TREE_CHAIN (method) = PROTOCOL_OPTIONAL_NST_METHODS (class);
- PROTOCOL_OPTIONAL_NST_METHODS (class) = method;
- }
- }
+ {
+ if (is_class)
+ {
+ TREE_CHAIN (method) = PROTOCOL_OPTIONAL_CLS_METHODS (class);
+ PROTOCOL_OPTIONAL_CLS_METHODS (class) = method;
+ }
+ else
+ {
+ TREE_CHAIN (method) = PROTOCOL_OPTIONAL_NST_METHODS (class);
+ PROTOCOL_OPTIONAL_NST_METHODS (class) = method;
+ }
+ }
}
else
/* APPLE LOCAL end C* language */
@@ -18354,6 +18388,8 @@
#endif
METHOD_DEFINITION (method) = current_function_decl;
+ /* APPLE LOCAL deprecated use in deprecated 6425499 */
+ TREE_DEPRECATED (current_function_decl) = TREE_DEPRECATED (method);
/* Check consistency...start_function, pushdecl, duplicate_decls. */
Modified: llvm-gcc-4.2/trunk/gcc/objc/objc-lang.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/objc/objc-lang.c?rev=62484&r1=62483&r2=62484&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/objc/objc-lang.c (original)
+++ llvm-gcc-4.2/trunk/gcc/objc/objc-lang.c Sun Jan 18 20:32:07 2009
@@ -35,6 +35,8 @@
enum c_language_kind c_language = clk_objc;
static void objc_init_ts (void);
+/* APPLE LOCAL radar 6386976 */
+bool objc_is_runtime_type (tree);
/* Lang hooks common to C and ObjC are declared in c-objc-common.h;
consequently, there should be very few hooks below. */
@@ -51,6 +53,10 @@
#define LANG_HOOKS_GET_CALLEE_FNDECL objc_get_callee_fndecl
#undef LANG_HOOKS_INIT_TS
#define LANG_HOOKS_INIT_TS objc_init_ts
+/* APPLE LOCAL begin radar 6386976 */
+#undef LANG_HOOKS_IS_RUNTIME_SPECIFIC_TYPE
+#define LANG_HOOKS_IS_RUNTIME_SPECIFIC_TYPE objc_is_runtime_type
+/* APPLE LOCAL end radar 6386976 */
/* Each front end provides its own lang hook initializer. */
const struct lang_hooks lang_hooks = LANG_HOOKS_INITIALIZER;
@@ -140,4 +146,15 @@
objc_finish_file ();
}
+/* APPLE LOCAL begin radar 6386976 */
+bool
+objc_is_runtime_type (tree type)
+{
+ if (TREE_CODE (type) != RECORD_TYPE)
+ return false;
+
+ else
+ return (TYPE_HAS_OBJC_INFO (type));
+}
+/* APPLE LOCAL end radar 6386976 */
#include "gtype-objc.h"
Modified: llvm-gcc-4.2/trunk/gcc/objcp/objcp-decl.h
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/objcp/objcp-decl.h?rev=62484&r1=62483&r2=62484&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/objcp/objcp-decl.h (original)
+++ llvm-gcc-4.2/trunk/gcc/objcp/objcp-decl.h Sun Jan 18 20:32:07 2009
@@ -80,6 +80,11 @@
#define OBJCP_ORIGINAL_FUNCTION(name, args) (name)args
+/* APPLE LOCAL begin radar 6386976 */
+#define TYPE_HAS_OBJCXX_INFO(TYPE) \
+ (TYPE_LANG_SPECIFIC (TYPE) && TYPE_OBJC_INFO (TYPE))
+/* APPLE LOCAL end radar 6386976 */
+
/* C++ marks ellipsis-free function parameters differently from C. */
#undef OBJC_VOID_AT_END
#define OBJC_VOID_AT_END void_list_node
Modified: llvm-gcc-4.2/trunk/gcc/objcp/objcp-lang.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/objcp/objcp-lang.c?rev=62484&r1=62483&r2=62484&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/objcp/objcp-lang.c (original)
+++ llvm-gcc-4.2/trunk/gcc/objcp/objcp-lang.c Sun Jan 18 20:32:07 2009
@@ -28,6 +28,10 @@
#include "c-common.h"
#include "toplev.h"
#include "objc-act.h"
+/* APPLE LOCAL begin radar 6386976 */
+#define OBJCP_REMAP_FUNCTIONS
+#include "objcp-decl.h"
+/* APPLE LOCAL end radar 6386976 */
#include "langhooks.h"
#include "langhooks-def.h"
#include "diagnostic.h"
@@ -36,6 +40,8 @@
enum c_language_kind c_language = clk_objcxx;
static void objcxx_init_ts (void);
+/* APPLE LOCAL radar 6386976 */
+static bool objcxx_is_runtime_type (tree);
/* Lang hooks common to C++ and ObjC++ are declared in cp/cp-objcp-common.h;
consequently, there should be very few hooks below. */
@@ -56,6 +62,10 @@
#undef LANG_HOOKS_FOLD_OBJ_TYPE_REF
#define LANG_HOOKS_FOLD_OBJ_TYPE_REF objc_fold_obj_type_ref
/* APPLE LOCAL end radar 3904178 */
+/* APPLE LOCAL begin radar 6386976 */
+#undef LANG_HOOKS_IS_RUNTIME_SPECIFIC_TYPE
+#define LANG_HOOKS_IS_RUNTIME_SPECIFIC_TYPE objcxx_is_runtime_type
+/* APPLE LOCAL end radar 6386976 */
/* Each front end provides its own lang hook initializer. */
const struct lang_hooks lang_hooks = LANG_HOOKS_INITIALIZER;
@@ -214,4 +224,15 @@
objc_finish_file ();
}
+/* APPLE LOCAL begin radar 6386976 */
+static bool
+objcxx_is_runtime_type (tree type)
+{
+ if (TREE_CODE (type) != RECORD_TYPE)
+ return false;
+ else
+ return (TYPE_HAS_OBJCXX_INFO (type));
+}
+/* APPLE LOCAL end radar 6386976 */
+
#include "gtype-objcp.h"
More information about the llvm-commits
mailing list