On Tue, Feb 23, 2016 at 08:24:06PM +0100, Marek Polacek wrote: > > --- gcc/c/c-parser.c.jj 2016-02-16 16:29:54.000000000 +0100 > > +++ gcc/c/c-parser.c 2016-02-18 17:36:55.025067859 +0100 > > @@ -5887,12 +5887,27 @@ c_parser_for_statement (c_parser *parser > > { > > c_token *token = c_parser_peek_token (parser); > > tree decl = lookup_name (token->value); > > - if (decl == NULL_TREE || VAR_P (decl)) > > - /* If DECL is null, we don't know what this token might be. Treat > > - it as an ID for better diagnostics; we'll error later on. */ > > - token->id_kind = C_ID_ID; > > - else if (TREE_CODE (decl) == TYPE_DECL) > > - token->id_kind = C_ID_TYPENAME; > > + if (token->id_kind != C_ID_CLASSNAME) > > + { > > + token->id_kind = C_ID_ID; > > I think let's sink the lookup_name call here. If id_kind is C_ID_CLASSNAME > we're not looking at decl at all.
Done (and committed). Thanks for review. > > + if (decl) > > + { > > + if (TREE_CODE (decl) == TYPE_DECL) > > + token->id_kind = C_ID_TYPENAME; > > + } > > + else if (c_dialect_objc ()) > > + { > > + tree objc_interface_decl = objc_is_class_name (token->value); > > This objc_is_class_name is a weird stub that always returns NULL_TREE but It is a weird stub only in the cc1 binary, in cc1obj binary it comes from objc/objc-act.c and does various ObjC magic. Jakub