OSDN Git Service

* ChangeLog: New.
authormrs <mrs@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 21 Apr 2005 22:19:42 +0000 (22:19 +0000)
committermrs <mrs@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 21 Apr 2005 22:19:42 +0000 (22:19 +0000)
        * Make-lang.in: Likewise.
        * config-lang.in: Likewise.
        * lang-specs.h: Likewise.
        * objcp-decl.c: Likewise.
        * objcp-decl.h: Likewise.
        * objcp-lang.c: Likewise.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@98530 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/objcp/ChangeLog [new file with mode: 0644]
gcc/objcp/Make-lang.in [new file with mode: 0644]
gcc/objcp/config-lang.in [new file with mode: 0644]
gcc/objcp/lang-specs.h [new file with mode: 0644]
gcc/objcp/objcp-decl.c [new file with mode: 0644]
gcc/objcp/objcp-decl.h [new file with mode: 0644]
gcc/objcp/objcp-lang.c [new file with mode: 0644]

diff --git a/gcc/objcp/ChangeLog b/gcc/objcp/ChangeLog
new file mode 100644 (file)
index 0000000..85bf984
--- /dev/null
@@ -0,0 +1,9 @@
+2005-04-21  Mike Stump  <mrs@apple.com>
+
+       * ChangeLog: New.
+       * Make-lang.in: Likewise.
+       * config-lang.in: Likewise.
+       * lang-specs.h: Likewise.
+       * objcp-decl.c: Likewise.
+       * objcp-decl.h: Likewise.
+       * objcp-lang.c: Likewise.
diff --git a/gcc/objcp/Make-lang.in b/gcc/objcp/Make-lang.in
new file mode 100644 (file)
index 0000000..51875e4
--- /dev/null
@@ -0,0 +1,138 @@
+# Top level -*- makefile -*- fragment for GNU Objective-C++
+#   Copyright (C) 2005 Free Software Foundation, Inc.
+#   Contributed by Ziemowit Laski  <zlaski@apple.com>
+
+#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 2, 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 COPYING.  If not, write to
+#the Free Software Foundation, 59 Temple Place - Suite 330,
+#Boston, MA 02111-1307, USA.
+
+# This file provides the language dependent support in the main Makefile.
+# Each language makefile fragment must provide the following targets:
+#
+# foo.all.build, foo.all.cross, foo.start.encap, foo.rest.encap,
+# foo.install-normal, foo.install-common, foo.install-man,
+# foo.uninstall,
+# foo.mostlyclean, foo.clean, foo.distclean,
+# foo.maintainer-clean, foo.stage1, foo.stage2, foo.stage3, foo.stage4
+#
+# where `foo' is the name of the language.
+#
+# It should also provide rules for:
+#
+# - making any compiler driver (eg: g++)
+# - the compiler proper (eg: cc1plus)
+# - define the names for selecting the language in LANGUAGES.
+
+#\f
+# Define the names for selecting Objective-C++ in LANGUAGES.
+OBJ-C++ obj-c++: cc1objplus$(exeext)
+
+# Tell GNU make to ignore these if they exist.
+.PHONY: Obj-c++ obj-C++
+
+# Use maximal warnings for this front end.  Also, make ObjC and C++
+# headers accessible.
+objcp-warn = $(STRICT_WARN) -DOBJCPLUS -I$(srcdir)/objc -I$(srcdir)/cp
+
+# Language-specific object files for Objective C++.
+OBJCXX_OBJS = objcp/objcp-act.o objcp/objcp-lang.o objcp/objcp-decl.o \
+   $(CXX_AND_OBJCXX_OBJS)
+
+cc1objplus$(exeext): $(OBJCXX_OBJS) $(BACKEND) $(LIBDEPS)
+       $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ \
+               $(OBJCXX_OBJS) $(BACKEND) $(LIBS)
+
+# Objective C++ language specific files.
+
+objcp/objcp-lang.o : objcp/objcp-lang.c \
+  $(CXX_TREE_H) $(TM_H) toplev.h debug.h langhooks.h objc/objc-act.h \
+  $(LANGHOOKS_DEF_H) c-common.h gtype-objcp.h $(CXX_PRETTY_PRINT_H) \
+  $(DIAGNOSTIC_H) cp/cp-objcp-common.h
+
+objcp/objcp-decl.o : objcp/objcp-decl.c \
+   $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) $(C_TREE_H) \
+   toplev.h $(GGC_H) c-pragma.h input.h flags.h output.h objc/objc-act.h \
+   objcp/objcp-decl.h
+
+# The following must be an explicit rule; please keep in sync with the implicit
+# one in Makefile.in.
+objcp/objcp-act.o : objc/objc-act.c \
+   $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) $(RTL_H) $(TM_P_H) \
+   $(EXPR_H) $(TARGET_H) $(CXX_TREE_H) diagnostic.h toplev.h flags.h \
+   objc/objc-act.h input.h function.h output.h debug.h langhooks.h \
+   objcp/objcp-decl.h $(LANGHOOKS_DEF_H) $(HASHTAB_H) gt-objc-objc-act.h
+       $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)
+
+po-generated:
+
+gtype-objcp.h : s-gtype ; @true
+
+#\f
+# Build hooks:
+
+obj-c++.all.build:
+obj-c++.all.cross:
+obj-c++.start.encap:
+obj-c++.rest.encap:
+obj-c++.info:
+obj-c++.srcinfo:
+obj-c++.srcextra:
+obj-c++.man:
+
+obj-c++.tags: force
+       cd $(srcdir)/objcp; etags -o TAGS.sub *.y *.c *.h; \
+       etags --include TAGS.sub --include ../TAGS.sub
+
+lang_checks += check-obj-c++
+
+#\f
+# Install hooks:
+# cc1objplus is installed elsewhere as part of $(COMPILERS).
+
+obj-c++.install-normal:
+
+obj-c++.install-common:
+
+obj-c++.install-man:
+
+obj-c++.uninstall:
+#\f
+# Clean hooks:
+# A lot of the ancillary files are deleted by the main makefile.
+# We just have to delete files specific to us.
+obj-c++.mostlyclean:
+       -rm -f objcp/*$(objext)
+       -rm -f objcp/*$(coverageexts)
+obj-c++.clean: obj-c++.mostlyclean
+obj-c++.distclean:
+       -rm -f objcp/config.status objcp/Makefile
+obj-c++.maintainer-clean:
+
+#\f
+# Stage hooks:
+
+obj-c++.stage1: stage1-start
+       -mv objcp/*$(objext) stage1/objcp
+obj-c++.stage2: stage2-start
+       -mv objcp/*$(objext) stage2/objcp
+obj-c++.stage3: stage3-start
+       -mv objcp/*$(objext) stage3/objcp
+obj-c++.stage4: stage4-start
+       -mv objcp/*$(objext) stage4/objcp
+obj-c++.stageprofile: stageprofile-start
+       -mv objcp/*$(objext) stageprofile/objcp
+obj-c++.stagefeedback: stagefeedback-start
+       -mv objcp/*$(objext) stagefeedback/objcp
diff --git a/gcc/objcp/config-lang.in b/gcc/objcp/config-lang.in
new file mode 100644 (file)
index 0000000..b5374dd
--- /dev/null
@@ -0,0 +1,43 @@
+# Top level configure fragment for GNU Objective-C++.
+#   Copyright (C) 2005 Free Software Foundation, Inc.
+#   Contributed by Ziemowit Laski <zlaski@apple.com>
+
+#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 2, 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 COPYING.  If not, write to
+#the Free Software Foundation, 59 Temple Place - Suite 330,
+#Boston, MA 02111-1307, USA.
+
+# Configure looks for the existence of this file to auto-config each language.
+# We define several parameters used by configure:
+#
+# language     - name of language as it would appear in $(LANGUAGES)
+# compilers    - value to add to $(COMPILERS)
+# stagestuff   - files to add to $(STAGESTUFF)
+
+language="obj-c++"
+
+compilers="cc1objplus\$(exeext)"
+
+stagestuff=""
+
+# Per GCC Steering Committee.
+build_by_default="no"
+
+# By building the Objective-C and C++ front-ends, we will get
+# the object files we need, along with the libraries (libstdc++,
+# libobjc).
+lang_requires="objc c++"
+
+gtfiles="\$(srcdir)/objcp/objcp-decl.c \$(srcdir)/objc/objc-act.c \$(srcdir)/objc/objc-act.h \$(srcdir)/cp/mangle.c \$(srcdir)/cp/name-lookup.h \$(srcdir)/cp/name-lookup.c \$(srcdir)/cp/cp-tree.h \$(srcdir)/cp/decl.h \$(srcdir)/cp/call.c \$(srcdir)/cp/decl.c \$(srcdir)/cp/decl2.c \$(srcdir)/cp/pt.c \$(srcdir)/cp/repo.c \$(srcdir)/cp/semantics.c \$(srcdir)/cp/tree.c \$(srcdir)/cp/parser.c \$(srcdir)/cp/method.c \$(srcdir)/cp/typeck2.c \$(srcdir)/c-common.c \$(srcdir)/c-common.h \$(srcdir)/c-lex.c \$(srcdir)/c-pragma.c"
diff --git a/gcc/objcp/lang-specs.h b/gcc/objcp/lang-specs.h
new file mode 100644 (file)
index 0000000..be25eb1
--- /dev/null
@@ -0,0 +1,60 @@
+/* Definitions for specs for Objective-C++.
+   Copyright (C) 2005 Free Software Foundation, Inc.
+   Contributed by Ziemowit Laski  <zlaski@apple.com>
+
+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 2, 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 COPYING.  If not, write to
+the Free Software Foundation, 59 Temple Place - Suite 330,
+Boston, MA 02111-1307, USA.  */
+
+/* This is the contribution to the `default_compilers' array in gcc.c for
+   obj-c++.  It is based on -- and should be kept in sync with -- the g++
+   spec (found in cp/lang-specs.h).  */
+
+#ifndef CPLUSPLUS_CPP_SPEC
+#define CPLUSPLUS_CPP_SPEC 0
+#endif
+
+  {".mm",  "@objective-c++", 0, 0, 0},
+  {".M",   "@objective-c++", 0, 0, 0},
+  {"@objective-c++-header",
+    "%{E|M|MM:cc1objplus -E %(cpp_options) %2 %(cpp_debug_options)}\
+     %{!E:%{!M:%{!MM:\
+       %{save-temps|no-integrated-cpp:cc1objplus -E\
+               %(cpp_options) %2 -o %{save-temps:%b.mii} %{!save-temps:%g.mii} \n}\
+      cc1objplus %{save-temps|no-integrated-cpp:-fpreprocessed %{save-temps:%b.mii} %{!save-temps:%g.mii}}\
+             %{!save-temps:%{!no-integrated-cpp:%(cpp_unique_options)}}\
+       %(cc1_options) %2 %{+e1*}\
+        -o %g.s %{!o*:--output-pch=%i.gch} %W{o*:--output-pch=%*}%V}}}",
+     CPLUSPLUS_CPP_SPEC, 0, 0},
+  {"@objective-c++",
+    "%{E|M|MM:cc1objplus -E %(cpp_options) %2 %(cpp_debug_options)}\
+     %{!E:%{!M:%{!MM:\
+       %{save-temps|no-integrated-cpp:cc1objplus -E\
+               %(cpp_options) %2 -o %{save-temps:%b.mii} %{!save-temps:%g.mii} \n}\
+      cc1objplus %{save-temps|no-integrated-cpp:-fpreprocessed %{save-temps:%b.mii} %{!save-temps:%g.mii}}\
+             %{!save-temps:%{!no-integrated-cpp:%(cpp_unique_options)}}\
+       %(cc1_options) %2 %{+e1*}\
+       %{!fsyntax-only:%(invoke_as)}}}}",
+     CPLUSPLUS_CPP_SPEC, 0, 0},
+  {".mii", "@objective-c++-cpp-output", 0, 0, 0},
+  {"@objective-c++-cpp-output",
+   "%{!M:%{!MM:%{!E:\
+    cc1objplus -fpreprocessed %i %(cc1_options) %2 %{+e*}\
+    %{!fsyntax-only:%(invoke_as)}}}}", 0, 0, 0},
+  {"@objc++-cpp-output",
+   "%{!M:%{!MM:%{!E:\
+    cc1objplus -fpreprocessed %i %(cc1_options) %2 %{+e*}\
+    %{!fsyntax-only:%(invoke_as)}}}}", 0, 0, 0},
diff --git a/gcc/objcp/objcp-decl.c b/gcc/objcp/objcp-decl.c
new file mode 100644 (file)
index 0000000..7493a23
--- /dev/null
@@ -0,0 +1,134 @@
+/* Process the ObjC-specific declarations and variables for 
+   the Objective-C++ compiler.
+   Copyright (C) 2005 Free Software Foundation, Inc.
+   Contributed by Ziemowit Laski  <zlaski@apple.com>
+
+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 2, 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 COPYING.  If not, write to the Free
+Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+02111-1307, USA.  */
+
+#include "config.h"
+#include "system.h"
+#include "coretypes.h"
+#include "tm.h"
+#include "tree.h"
+#include "rtl.h"
+#include "expr.h"
+#include "cp-tree.h"
+#include "c-common.h"
+#include "flags.h"
+#include "input.h"
+#include "except.h"
+#include "output.h"
+#include "toplev.h"
+#include "cpplib.h"
+#include "debug.h"
+#include "target.h"
+#include "varray.h"
+
+#include "objc-act.h"
+#include "objcp-decl.h"
+
+/* Hacks to simulate start_struct() and finish_struct(). */
+
+tree 
+objcp_start_struct (enum tree_code code ATTRIBUTE_UNUSED, tree name)
+{
+  tree s;
+  /* The idea here is to mimic the actions that the C++ parser takes when
+     constructing 'extern "C" struct NAME {'.  */
+  push_lang_context (lang_name_c);
+  if (!name)
+    name = make_anon_name ();
+  s = xref_tag (record_type, name, ts_current, 0);
+  CLASSTYPE_DECLARED_CLASS (s) = 0;  /* this is a 'struct', not a 'class'.  */
+  xref_basetypes (s, NULL_TREE);     /* no base classes here!  */
+
+  return begin_class_definition (s);
+}
+
+tree 
+objcp_finish_struct (tree t, tree fieldlist, tree attributes)
+{
+  tree field, next_field;
+
+  for (field = fieldlist; field; field = next_field)
+  {
+    next_field = TREE_CHAIN (field);      /* insert one field at a time;  */
+    TREE_CHAIN (field) = NULL_TREE;       /* otherwise, grokfield croaks. */
+    finish_member_declaration (field);
+  }
+  t = finish_struct (t, attributes);
+  pop_lang_context ();
+
+  return t;
+}
+
+void
+objcp_finish_function (void)
+{
+  /* The C++ flavor of 'finish_function' does not generate RTL -- one has
+     to call 'expand_or_defer_fn' to do that.  */
+  expand_or_defer_fn (finish_function (0));
+}
+
+tree
+objcp_lookup_name (tree name)
+{
+  return lookup_name (name, -1);
+}
+
+tree
+objcp_xref_tag (enum tree_code code ATTRIBUTE_UNUSED, tree name)
+{
+  return xref_tag (record_type, name, true, false);
+}
+
+tree
+objcp_build_component_ref (tree datum, tree component)
+{
+  /* The 'build_component_ref' routine has been removed from the C++
+     front-end, but 'finish_class_member_access_expr' seems to be
+     a worthy substitute.  */
+  return finish_class_member_access_expr (datum, component);
+}
+
+int
+objcp_comptypes (tree type1, tree type2)
+{     
+  return comptypes (type1, type2, COMPARE_STRICT);
+}
+
+tree
+objcp_begin_compound_stmt (int flags ATTRIBUTE_UNUSED)
+{
+  return begin_compound_stmt (0);
+}
+
+tree
+objcp_end_compound_stmt (tree stmt, int flags ATTRIBUTE_UNUSED)
+{
+  /* The following has been snarfed from
+     cp/semantics.c:finish_compound_stmt().  */
+  if (TREE_CODE (stmt) == BIND_EXPR)
+    BIND_EXPR_BODY (stmt) = do_poplevel (BIND_EXPR_BODY (stmt));
+  else if (STATEMENT_LIST_NO_SCOPE (stmt))
+    stmt = pop_stmt_list (stmt);
+  else
+    stmt = do_poplevel (stmt);
+
+  return stmt;
+}
diff --git a/gcc/objcp/objcp-decl.h b/gcc/objcp/objcp-decl.h
new file mode 100644 (file)
index 0000000..39cad46
--- /dev/null
@@ -0,0 +1,95 @@
+/* Process the ObjC-specific declarations and variables for 
+   the Objective-C++ compiler.
+   Copyright (C) 2005 Free Software Foundation, Inc.
+   Contributed by Ziemowit Laski  <zlaski@apple.com>
+
+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 2, 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 COPYING.  If not, write to the Free
+Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+02111-1307, USA.  */
+
+#ifndef GCC_OBJCP_DECL_H
+#define GCC_OBJCP_DECL_H
+
+extern tree objcp_start_struct (enum tree_code, tree);
+extern tree objcp_finish_struct (tree, tree, tree);
+extern void objcp_finish_function (void);
+extern tree objcp_lookup_name (tree);
+extern tree objcp_build_function_call (tree, tree);
+extern tree objcp_xref_tag (enum tree_code, tree);
+extern tree objcp_build_component_ref (tree, tree);
+extern int objcp_comptypes (tree, tree);
+extern tree objcp_builtin_function (const char *, tree, int, 
+                                   enum built_in_class, const char *, tree);
+extern tree objcp_begin_compound_stmt (int);
+extern tree objcp_end_compound_stmt (tree, int);
+
+/* Now "cover up" the corresponding C++ functions if required (NB: the 
+   OBJCP_ORIGINAL_FUNCTION macro, shown below, can still be used to
+   invoke the original C++ functions if needed).  */
+#ifdef OBJCP_REMAP_FUNCTIONS
+
+#define start_struct(code, name) \
+       objcp_start_struct (code, name)
+#define finish_struct(t, fieldlist, attributes) \
+       objcp_finish_struct (t, fieldlist, attributes)
+#define finish_function() \
+       objcp_finish_function ()
+#define lookup_name(name) \
+       objcp_lookup_name (name)
+#define xref_tag(code, name) \
+       objcp_xref_tag (code, name)
+#define build_component_ref(datum, component) \
+        objcp_build_component_ref (datum, component)
+#define comptypes(type1, type2) \
+       objcp_comptypes (type1, type2)
+#define c_begin_compound_stmt(flags) \
+       objcp_begin_compound_stmt (flags)
+#define c_end_compound_stmt(stmt, flags) \
+       objcp_end_compound_stmt (stmt, flags)
+
+#undef OBJC_TYPE_NAME
+#define OBJC_TYPE_NAME(type) \
+  (TYPE_NAME (type) && TREE_CODE (TYPE_NAME (type)) == TYPE_DECL \
+   ? DECL_NAME (TYPE_NAME (type)) \
+   : TYPE_NAME (type))
+#undef OBJC_SET_TYPE_NAME
+#define OBJC_SET_TYPE_NAME(type, name) \
+  if(TYPE_NAME (type) && TREE_CODE (TYPE_NAME (type)) == TYPE_DECL) \
+    DECL_NAME (TYPE_NAME (type)) = name; \
+  else \
+    TYPE_NAME (type) = name;
+
+#undef TYPE_OBJC_INFO
+#define TYPE_OBJC_INFO(TYPE) LANG_TYPE_CLASS_CHECK (TYPE)->objc_info
+#undef SIZEOF_OBJC_TYPE_LANG_SPECIFIC
+#define SIZEOF_OBJC_TYPE_LANG_SPECIFIC sizeof (struct lang_type_class)
+#undef ALLOC_OBJC_TYPE_LANG_SPECIFIC
+#define ALLOC_OBJC_TYPE_LANG_SPECIFIC(NODE)                            \
+  do {                                                                 \
+    TYPE_LANG_SPECIFIC (NODE) = GGC_CNEWVAR                            \
+      (struct lang_type, sizeof (struct lang_type_class));             \
+    TYPE_LANG_SPECIFIC (NODE)->u.c.h.is_lang_type_class = 1;           \
+  } while (0)
+
+#define OBJCP_ORIGINAL_FUNCTION(name, args)    (name)args
+
+/* C++ marks ellipsis-free function parameters differently from C.  */
+#undef OBJC_VOID_AT_END
+#define OBJC_VOID_AT_END        void_list_node
+
+#endif  /* OBJCP_REMAP_FUNCTIONS */
+
+#endif /* ! GCC_OBJCP_DECL_H */
diff --git a/gcc/objcp/objcp-lang.c b/gcc/objcp/objcp-lang.c
new file mode 100644 (file)
index 0000000..8f70419
--- /dev/null
@@ -0,0 +1,143 @@
+/* Language-dependent hooks for Objective-C++.
+   Copyright 2005 Free Software Foundation, Inc.
+   Contributed by Ziemowit Laski  <zlaski@apple.com>
+
+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 2, 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 COPYING.  If not, write to
+the Free Software Foundation, 59 Temple Place - Suite 330,
+Boston, MA 02111-1307, USA.  */
+
+#include "config.h"
+#include "system.h"
+#include "coretypes.h"
+#include "tm.h"
+#include "tree.h"
+#include "cp-tree.h"
+#include "c-common.h"
+#include "toplev.h"
+#include "objc-act.h"
+#include "langhooks.h"
+#include "langhooks-def.h"
+#include "diagnostic.h"
+#include "cxx-pretty-print.h"
+#include "debug.h"
+#include "cp-objcp-common.h"
+
+enum c_language_kind c_language = clk_objcxx;
+
+/* Lang hooks common to C++ and ObjC++ are declared in cp/cp-objcp-common.h;
+   consequently, there should be very few hooks below.  */
+
+#undef LANG_HOOKS_NAME
+#define LANG_HOOKS_NAME "GNU Objective-C++"
+#undef LANG_HOOKS_INIT
+#define LANG_HOOKS_INIT objc_init
+#undef LANG_HOOKS_DECL_PRINTABLE_NAME
+#define LANG_HOOKS_DECL_PRINTABLE_NAME objc_printable_name
+#undef LANG_HOOKS_TYPES_COMPATIBLE_P
+#define LANG_HOOKS_TYPES_COMPATIBLE_P objc_types_compatible_p
+#undef LANG_HOOKS_GET_CALLEE_FNDECL
+#define LANG_HOOKS_GET_CALLEE_FNDECL   objc_get_callee_fndecl
+/* Each front end provides its own lang hook initializer.  */
+const struct lang_hooks lang_hooks = LANG_HOOKS_INITIALIZER;
+
+/* Tree code classes.  */
+
+#define DEFTREECODE(SYM, NAME, TYPE, LENGTH) TYPE,
+
+const enum tree_code_class tree_code_type[] = {
+#include "tree.def"
+  tcc_exceptional,
+#include "c-common.def"
+  tcc_exceptional,
+#include "cp-tree.def"
+  tcc_exceptional,
+#include "objc-tree.def"
+};
+#undef DEFTREECODE
+
+/* Table indexed by tree code giving number of expression
+   operands beyond the fixed part of the node structure.
+   Not used for types or decls.  */
+
+#define DEFTREECODE(SYM, NAME, TYPE, LENGTH) LENGTH,
+
+const unsigned char tree_code_length[] = {
+#include "tree.def"
+  0,
+#include "c-common.def"
+  0,
+#include "cp-tree.def"
+  0,
+#include "objc-tree.def"
+};
+#undef DEFTREECODE
+
+/* Names of tree components.
+   Used for printing out the tree and error messages.  */
+#define DEFTREECODE(SYM, NAME, TYPE, LEN) NAME,
+
+const char *const tree_code_name[] = {
+#include "tree.def"
+  "@@dummy",
+#include "c-common.def"
+  "@@dummy",
+#include "cp-tree.def"
+  "@@dummy",
+#include "objc-tree.def"
+};
+#undef DEFTREECODE
+
+/* Lang hook routines common to C++ and ObjC++ appear in cp/cp-objcp-common.c;
+   there should be very few (if any) routines below.  */
+
+tree
+objcp_tsubst_copy_and_build (tree t, tree args, tsubst_flags_t complain, 
+                            tree in_decl, bool function_p ATTRIBUTE_UNUSED)
+{
+#define RECURSE(NODE) \
+  tsubst_copy_and_build (NODE, args, complain, in_decl, /*function_p=*/false)
+
+  /* The following two can only occur in Objective-C++.  */
+
+  switch ((int) TREE_CODE (t))
+    {
+    case MESSAGE_SEND_EXPR:
+      return objc_finish_message_expr
+       (RECURSE (TREE_OPERAND (t, 0)),
+        TREE_OPERAND (t, 1),  /* No need to expand the selector.  */
+        RECURSE (TREE_OPERAND (t, 2)));
+
+    case CLASS_REFERENCE_EXPR:
+      return objc_get_class_reference
+       (RECURSE (TREE_OPERAND (t, 0)));
+
+    default:
+      break;
+    }
+
+  /* Fall back to C++ processing.  */
+  return NULL_TREE;
+
+#undef RECURSE
+}
+
+void
+finish_file (void)
+{
+  objc_finish_file ();
+}
+
+#include "gtype-objcp.h"