t-darwin (build/slashify): Allow others to reuse easier.
gcc: * config/t-darwin (build/slashify): Allow others to reuse easier. objcp: * Make-lang.in (obj-c++.tags): Plugify Objective-C++. * plugin/parser.h: Likewise. * plugin/parser.c: Likewise. cp: * Make-lang.in (build/slashify): Plugify Objective-C++. (cp/parser.o): Likewise. (objcp/plugin/parser.h): Likewise. From-SVN: r170101
This commit is contained in:
parent
8efc91cde4
commit
ba326d364d
9 changed files with 2179 additions and 2023 deletions
|
@ -1,3 +1,7 @@
|
|||
2011-02-12 Mike Stump <mikestump@comcast.net>
|
||||
|
||||
* config/t-darwin (build/slashify): Allow others to reuse easier.
|
||||
|
||||
2011-02-12 Mike Stump <mikestump@comcast.net>
|
||||
|
||||
* config/darwin.h: Make pretty.
|
||||
|
|
|
@ -17,8 +17,8 @@
|
|||
# along with GCC; see the file COPYING3. If not see
|
||||
# <http://www.gnu.org/licenses/>.
|
||||
|
||||
build/slashify: $(srcdir)/config/slashify.c
|
||||
$(COMPILER_FOR_BUILD) $< -o $@
|
||||
build/slashify:: $(srcdir)/config/slashify.c
|
||||
$(COMPILER_FOR_BUILD) $(srcdir)/config/slashify.c -o $@
|
||||
|
||||
$(srcdir)/config/darwin.h: config/darwin.h.rebuild
|
||||
|
||||
|
|
|
@ -1,3 +1,10 @@
|
|||
2011-02-12 Mike Stump <mikestump@comcast.net>
|
||||
|
||||
* Make-lang.in (build/slashify): Plugify Objective-C++.
|
||||
(cp/parser.o): Likewise.
|
||||
(objcp/plugin/parser.h): Likewise.
|
||||
* parser.c (cp_parser_token_starts_cast_expression): Likewise.
|
||||
|
||||
2011-02-09 Jason Merrill <jason@redhat.com>
|
||||
|
||||
* decl.c (cp_make_fname_decl): Set DECL_THIS_STATIC at toplevel.
|
||||
|
|
|
@ -326,3 +326,16 @@ cp/name-lookup.o: cp/name-lookup.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
|
|||
|
||||
cp/cxx-pretty-print.o: cp/cxx-pretty-print.c $(CXX_PRETTY_PRINT_H) \
|
||||
$(CONFIG_H) $(SYSTEM_H) $(TM_H) coretypes.h $(CXX_TREE_H) tree-pretty-print.h
|
||||
|
||||
|
||||
# Objective-C++ related rules:
|
||||
|
||||
cp/parser.o: $(objdir)/objcp/plugin/parser.h $(srcdir)/objcp/plugin/parser.c
|
||||
|
||||
build/slashify:: $(srcdir)/config/slashify.c
|
||||
$(COMPILER_FOR_BUILD) $(srcdir)/config/slashify.c -o $@
|
||||
|
||||
$(objdir)/objcp/plugin/parser.h: $(srcdir)/objcp/plugin/parser.h | build/slashify
|
||||
test -d objcp || mkdir objcp
|
||||
test -d objcp/plugin || mkdir objcp/plugin
|
||||
build/slashify < $< > $@
|
||||
|
|
2037
gcc/cp/parser.c
2037
gcc/cp/parser.c
File diff suppressed because it is too large
Load diff
|
@ -1,3 +1,9 @@
|
|||
2011-02-12 Mike Stump <mikestump@comcast.net>
|
||||
|
||||
* Make-lang.in (obj-c++.tags): Plugify Objective-C++.
|
||||
* plugin/parser.h: Likewise.
|
||||
* plugin/parser.c: Likewise.
|
||||
|
||||
2011-02-07 Mike Stump <mikestump@comcast.net>
|
||||
|
||||
* Make-lang.in (obj-c++.tags): Don't include *.y.
|
||||
|
|
|
@ -110,7 +110,7 @@ obj-c++.man:
|
|||
obj-c++.install-plugin:
|
||||
|
||||
obj-c++.tags: force
|
||||
cd $(srcdir)/objcp; etags -o TAGS.sub *.c *.h; \
|
||||
cd $(srcdir)/objcp; etags -o TAGS.sub *.c *.h plugin/*.h plugin/*.c; \
|
||||
etags --include TAGS.sub --include ../TAGS.sub
|
||||
|
||||
lang_checks += check-obj-c++
|
||||
|
|
1902
gcc/objcp/plugin/parser.c
Normal file
1902
gcc/objcp/plugin/parser.c
Normal file
File diff suppressed because it is too large
Load diff
227
gcc/objcp/plugin/parser.h
Normal file
227
gcc/objcp/plugin/parser.h
Normal file
|
@ -0,0 +1,227 @@
|
|||
/* Objective-C++ Parser plugin
|
||||
Copyright (C) 2000, 2001, 2002, 2003, 2004,
|
||||
2005, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GCC.
|
||||
|
||||
GCC is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 3, or (at your option)
|
||||
any later version.
|
||||
|
||||
GCC is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GCC; see the file COPYING3. If not see
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
|
||||
/* This isn't defined anywhere, yet, but it could be. This will turn off
|
||||
the entire C++ Objective-C++ plugin. */
|
||||
#ifdef HIDE_OBJC
|
||||
|
||||
#include "c-family/c-objc.h"
|
||||
|
||||
|
||||
/* Objective-C++ Productions */
|
||||
|
||||
static tree cp_parser_objc_message_receiver
|
||||
(cp_parser *);
|
||||
static tree cp_parser_objc_message_args
|
||||
(cp_parser *);
|
||||
static tree cp_parser_objc_message_expression
|
||||
(cp_parser *);
|
||||
static tree cp_parser_objc_encode_expression
|
||||
(cp_parser *);
|
||||
static tree cp_parser_objc_defs_expression
|
||||
(cp_parser *);
|
||||
static tree cp_parser_objc_protocol_expression
|
||||
(cp_parser *);
|
||||
static tree cp_parser_objc_selector_expression
|
||||
(cp_parser *);
|
||||
static tree cp_parser_objc_expression
|
||||
(cp_parser *);
|
||||
static bool cp_parser_objc_selector_p
|
||||
(enum cpp_ttype);
|
||||
static tree cp_parser_objc_selector
|
||||
(cp_parser *);
|
||||
static tree cp_parser_objc_protocol_refs_opt
|
||||
(cp_parser *);
|
||||
static void cp_parser_objc_declaration
|
||||
(cp_parser *, tree);
|
||||
static tree cp_parser_objc_statement
|
||||
(cp_parser *);
|
||||
static bool cp_parser_objc_valid_prefix_attributes
|
||||
(cp_parser *, tree *);
|
||||
static void cp_parser_objc_at_property_declaration
|
||||
(cp_parser *) ;
|
||||
static void cp_parser_objc_at_synthesize_declaration
|
||||
(cp_parser *) ;
|
||||
static void cp_parser_objc_at_dynamic_declaration
|
||||
(cp_parser *) ;
|
||||
static tree cp_parser_objc_struct_declaration
|
||||
(cp_parser *) ;
|
||||
|
||||
#define PLUGIN_PRIMARY_EXPRESSION_3(parser) @(
|
||||
do {
|
||||
if (c_dialect_objc ())
|
||||
/* We have an Objective-C++ message. */
|
||||
return cp_parser_objc_expression (parser);
|
||||
} while (0)@)
|
||||
|
||||
#define PLUGIN_PRIMARY_EXPRESSION_2(parser, cp_parser_error) @(
|
||||
case CPP_OBJC_STRING:
|
||||
if (c_dialect_objc ())
|
||||
/* We have an Objective-C++ string literal. */
|
||||
return cp_parser_objc_expression (parser);
|
||||
cp_parser_error (parser, "expected primary-expression");
|
||||
return error_mark_node;@)
|
||||
|
||||
#define PLUGIN_PRIMARY_EXPRESSION_1(parser) @(
|
||||
/* Objective-C++ expressions. */
|
||||
case RID_AT_ENCODE:
|
||||
case RID_AT_PROTOCOL:
|
||||
case RID_AT_SELECTOR:
|
||||
return cp_parser_objc_expression (parser);@)
|
||||
|
||||
#define PLUGIN_PRIMARY_EXPRESSION(parser, decl, cp_lexer_consume_token, cp_lexer_peek_token) @(
|
||||
do {
|
||||
/* In Objective-C++, we may have an Objective-C 2.0
|
||||
dot-syntax for classes here. */
|
||||
if (c_dialect_objc ()
|
||||
&& cp_lexer_peek_token (parser->lexer)->type == CPP_DOT
|
||||
&& TREE_CODE (decl) == TYPE_DECL
|
||||
&& objc_is_class_name (decl))
|
||||
{
|
||||
tree component;
|
||||
cp_lexer_consume_token (parser->lexer);
|
||||
component = cp_parser_identifier (parser);
|
||||
if (component == error_mark_node)
|
||||
return error_mark_node;
|
||||
|
||||
return objc_build_class_component_ref (id_expression, component);
|
||||
}
|
||||
|
||||
/* In Objective-C++, an instance variable (ivar) may be preferred
|
||||
to whatever cp_parser_lookup_name() found. */
|
||||
decl = objc_lookup_ivar (decl, id_expression);
|
||||
} while (0)@)
|
||||
|
||||
#define PLUGIN_TOKEN_STARTS_CAST_EXPR @(
|
||||
do {
|
||||
/* '[' may start a primary-expression in obj-c++. */
|
||||
return c_dialect_objc ();
|
||||
} while (0)@)
|
||||
|
||||
#define PLUGIN_STATEMENT @(
|
||||
/* Objective-C++ exception-handling constructs. */
|
||||
case RID_AT_TRY:
|
||||
case RID_AT_CATCH:
|
||||
case RID_AT_FINALLY:
|
||||
case RID_AT_SYNCHRONIZED:
|
||||
case RID_AT_THROW:
|
||||
statement = cp_parser_objc_statement (parser);
|
||||
break;@)
|
||||
|
||||
|
||||
#define PLUGIN_DECLARATION @(
|
||||
/* Objective-C++ declaration/definition. */
|
||||
else if (c_dialect_objc () && OBJC_IS_AT_KEYWORD (token1.keyword))
|
||||
cp_parser_objc_declaration (parser, NULL_TREE);
|
||||
else if (c_dialect_objc ()
|
||||
&& token1.keyword == RID_ATTRIBUTE
|
||||
&& cp_parser_objc_valid_prefix_attributes (parser, &attributes))
|
||||
cp_parser_objc_declaration (parser, attributes);@)
|
||||
|
||||
#define PLUGIN_SIMPLE_TYPE_SPECIFIER @(
|
||||
do {
|
||||
/* See if TYPE is an Objective-C type, and if so, parse and
|
||||
accept any protocol references following it. Do this before
|
||||
the cp_parser_check_for_invalid_template_id() call, because
|
||||
Objective-C types can be followed by '<...>' which would
|
||||
enclose protocol names rather than template arguments, and so
|
||||
everything is fine. */
|
||||
if (c_dialect_objc () && !parser->scope
|
||||
&& (objc_is_id (type) || objc_is_class_name (type)))
|
||||
{
|
||||
tree protos = cp_parser_objc_protocol_refs_opt (parser);
|
||||
tree qual_type = objc_get_protocol_qualified_type (type, protos);
|
||||
|
||||
/* Clobber the "unqualified" type previously entered into
|
||||
DECL_SPECS with the new, improved protocol-qualified version. */
|
||||
if (decl_specs)
|
||||
decl_specs->type = qual_type;
|
||||
|
||||
return qual_type;
|
||||
}
|
||||
} while (0)@)
|
||||
|
||||
|
||||
#define PLUGIN_NONCLASS_NAME1 @(
|
||||
do {
|
||||
if (TREE_CODE (type_decl) != TYPE_DECL
|
||||
&& (objc_is_id (identifier) || objc_is_class_name (identifier)))
|
||||
{
|
||||
/* See if this is an Objective-C type. */
|
||||
tree protos = cp_parser_objc_protocol_refs_opt (parser);
|
||||
tree type = objc_get_protocol_qualified_type (identifier, protos);
|
||||
if (type)
|
||||
type_decl = TYPE_NAME (type);
|
||||
}
|
||||
} while (0)@)
|
||||
|
||||
#define PLUGIN_NONCLASS_NAME @(
|
||||
/* In Objective-C, we have the complication that class names are
|
||||
normally type names and start declarations (eg, the
|
||||
"NSObject" in "NSObject *object;"), but can be used in an
|
||||
Objective-C 2.0 dot-syntax (as in "NSObject.version") which
|
||||
is an expression. So, a classname followed by a dot is not a
|
||||
valid type-name. */
|
||||
|| (objc_is_class_name (TREE_TYPE (type_decl))
|
||||
&& cp_lexer_peek_token (parser->lexer)->type == CPP_DOT)@)
|
||||
|
||||
#define PLUGIN_CLASS_NAME @(
|
||||
/* In Objective-C 2.0, a classname followed by '.' starts a
|
||||
dot-syntax expression, and it's not a type-name. */
|
||||
|| (c_dialect_objc ()
|
||||
&& cp_lexer_peek_token (parser->lexer)->type == CPP_DOT
|
||||
&& objc_is_class_name (decl))@)
|
||||
|
||||
#define PLUGIN_MEMBER_DECLARATION @(
|
||||
do {
|
||||
/* Check for @defs. */
|
||||
if (cp_lexer_next_token_is_keyword (parser->lexer, RID_AT_DEFS))
|
||||
{
|
||||
tree ivar, member;
|
||||
tree ivar_chains = cp_parser_objc_defs_expression (parser);
|
||||
ivar = ivar_chains;
|
||||
while (ivar)
|
||||
{
|
||||
member = ivar;
|
||||
ivar = TREE_CHAIN (member);
|
||||
TREE_CHAIN (member) = NULL_TREE;
|
||||
finish_member_declaration (member);
|
||||
}
|
||||
return;
|
||||
}
|
||||
} while (0)@)
|
||||
|
||||
#else
|
||||
|
||||
#define PLUGIN_PRIMARY_EXPRESSION_3(parser)
|
||||
#define PLUGIN_PRIMARY_EXPRESSION_2(parser, cp_parser_error)
|
||||
#define PLUGIN_PRIMARY_EXPRESSION_1(parser)
|
||||
#define PLUGIN_PRIMARY_EXPRESSION(parser, decl, cp_lexer_consume_token, cp_lexer_peek_token)
|
||||
#define PLUGIN_TOKEN_STARTS_CAST_EXPR
|
||||
#define PLUGIN_STATEMENT
|
||||
#define PLUGIN_DECLARATION
|
||||
#define PLUGIN_SIMPLE_TYPE_SPECIFIER
|
||||
#define PLUGIN_NONCLASS_NAME1
|
||||
#define PLUGIN_NONCLASS_NAME
|
||||
#define PLUGIN_CLASS_NAME
|
||||
#define PLUGIN_MEMBER_DECLARATION
|
||||
|
||||
#endif
|
Loading…
Add table
Reference in a new issue