From 0d8a2528265c57e2fd0c90f33c38f603db43695a Mon Sep 17 00:00:00 2001 From: Nicola Pero Date: Tue, 12 Apr 2011 16:45:40 +0000 Subject: [PATCH] In gcc/: 2011-04-12 Nicola Pero In gcc/: 2011-04-12 Nicola Pero * c-parser.c (c_lex_one_token): Rewritten conditional used when compiling Objective-C to be more efficient. In gcc/objc/: 2011-04-12 Nicola Pero * objc-act.c (objc_is_class_name, objc_is_id): For efficiency, avoid calling identifier_global_value() multiple times. From-SVN: r172327 --- gcc/ChangeLog | 5 +++++ gcc/c-parser.c | 3 +-- gcc/objc/ChangeLog | 5 +++++ gcc/objc/objc-act.c | 19 +++++++++++++------ 4 files changed, 24 insertions(+), 8 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index f35c45b33e5..f640b288cdb 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2011-04-12 Nicola Pero + + * c-parser.c (c_lex_one_token): Rewritten conditional used when + compiling Objective-C to be more efficient. + 2011-04-12 Axel Freyn * opts-common.c (decode_cmdline_options_to_array): Remove variable diff --git a/gcc/c-parser.c b/gcc/c-parser.c index 33e7362baa0..7542a58eac6 100644 --- a/gcc/c-parser.c +++ b/gcc/c-parser.c @@ -334,8 +334,7 @@ c_lex_one_token (c_parser *parser, c_token *token) variables and typedefs, and hence are shadowed by local declarations. */ if (objc_interface_decl - && (global_bindings_p () - || (!objc_force_identifier && !decl))) + && (!objc_force_identifier || global_bindings_p ())) { token->value = objc_interface_decl; token->id_kind = C_ID_CLASSNAME; diff --git a/gcc/objc/ChangeLog b/gcc/objc/ChangeLog index d91ca29a026..e9e3be6097f 100644 --- a/gcc/objc/ChangeLog +++ b/gcc/objc/ChangeLog @@ -1,3 +1,8 @@ +2011-04-12 Nicola Pero + + * objc-act.c (objc_is_class_name, objc_is_id): For efficiency, + avoid calling identifier_global_value() multiple times. + 2011-04-12 Martin Jambor * objc-act.c (mark_referenced_methods): Call cgraph_get_create_node diff --git a/gcc/objc/objc-act.c b/gcc/objc/objc-act.c index 513da2fe560..dd81fd1a5f5 100644 --- a/gcc/objc/objc-act.c +++ b/gcc/objc/objc-act.c @@ -3411,9 +3411,13 @@ objc_is_class_name (tree ident) { hash target; - if (ident && TREE_CODE (ident) == IDENTIFIER_NODE - && identifier_global_value (ident)) - ident = identifier_global_value (ident); + if (ident && TREE_CODE (ident) == IDENTIFIER_NODE) + { + tree t = identifier_global_value (ident); + if (t) + ident = t; + } + while (ident && TREE_CODE (ident) == TYPE_DECL && DECL_ORIGINAL_TYPE (ident)) ident = OBJC_TYPE_NAME (DECL_ORIGINAL_TYPE (ident)); @@ -3453,9 +3457,12 @@ objc_is_class_name (tree ident) tree objc_is_id (tree type) { - if (type && TREE_CODE (type) == IDENTIFIER_NODE - && identifier_global_value (type)) - type = identifier_global_value (type); + if (type && TREE_CODE (type) == IDENTIFIER_NODE) + { + tree t = identifier_global_value (type); + if (t) + type = t; + } if (type && TREE_CODE (type) == TYPE_DECL) type = TREE_TYPE (type); -- 2.30.2