190075Sobrien/* Language-dependent hooks for C++. 2169689Skan Copyright 2001, 2002, 2004 Free Software Foundation, Inc. 390075Sobrien Contributed by Alexandre Oliva <aoliva@redhat.com> 490075Sobrien 5132718SkanThis file is part of GCC. 690075Sobrien 7132718SkanGCC is free software; you can redistribute it and/or modify 890075Sobrienit under the terms of the GNU General Public License as published by 990075Sobrienthe Free Software Foundation; either version 2, or (at your option) 1090075Sobrienany later version. 1190075Sobrien 12132718SkanGCC is distributed in the hope that it will be useful, 1390075Sobrienbut WITHOUT ANY WARRANTY; without even the implied warranty of 1490075SobrienMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 1590075SobrienGNU General Public License for more details. 1690075Sobrien 1790075SobrienYou should have received a copy of the GNU General Public License 18132718Skanalong with GCC; see the file COPYING. If not, write to 19169689Skanthe Free Software Foundation, 51 Franklin Street, Fifth Floor, 20169689SkanBoston, MA 02110-1301, USA. */ 2190075Sobrien 2290075Sobrien#include "config.h" 2390075Sobrien#include "system.h" 24132718Skan#include "coretypes.h" 25132718Skan#include "tm.h" 2690075Sobrien#include "tree.h" 2790075Sobrien#include "cp-tree.h" 2890075Sobrien#include "c-common.h" 2990075Sobrien#include "toplev.h" 3090075Sobrien#include "langhooks.h" 3190075Sobrien#include "langhooks-def.h" 32132718Skan#include "diagnostic.h" 33169689Skan#include "debug.h" 34169689Skan#include "cp-objcp-common.h" 35169689Skan#include "hashtab.h" 3690075Sobrien 37132718Skanenum c_language_kind c_language = clk_cxx; 38169689Skanstatic void cp_init_ts (void); 3990075Sobrien 40169689Skan/* Lang hooks common to C++ and ObjC++ are declared in cp/cp-objcp-common.h; 41169689Skan consequently, there should be very few hooks below. */ 42132718Skan 4390075Sobrien#undef LANG_HOOKS_NAME 4490075Sobrien#define LANG_HOOKS_NAME "GNU C++" 4590075Sobrien#undef LANG_HOOKS_INIT 4690075Sobrien#define LANG_HOOKS_INIT cxx_init 47259268Spfg#undef LANG_HOOKS_GENERIC_TYPE_P 48259268Spfg#define LANG_HOOKS_GENERIC_TYPE_P class_tmpl_impl_spec_p 49117395Skan#undef LANG_HOOKS_DECL_PRINTABLE_NAME 50117395Skan#define LANG_HOOKS_DECL_PRINTABLE_NAME cxx_printable_name 51169689Skan#undef LANG_HOOKS_FOLD_OBJ_TYPE_REF 52169689Skan#define LANG_HOOKS_FOLD_OBJ_TYPE_REF cp_fold_obj_type_ref 53169689Skan#undef LANG_HOOKS_INIT_TS 54169689Skan#define LANG_HOOKS_INIT_TS cp_init_ts 5590075Sobrien 56169689Skan/* Each front end provides its own lang hook initializer. */ 5790075Sobrienconst struct lang_hooks lang_hooks = LANG_HOOKS_INITIALIZER; 5890075Sobrien 59117395Skan/* Tree code classes. */ 60117395Skan 61117395Skan#define DEFTREECODE(SYM, NAME, TYPE, LENGTH) TYPE, 62117395Skan 63169689Skanconst enum tree_code_class tree_code_type[] = { 64117395Skan#include "tree.def" 65169689Skan tcc_exceptional, 66117395Skan#include "c-common.def" 67169689Skan tcc_exceptional, 68117395Skan#include "cp-tree.def" 69117395Skan}; 70117395Skan#undef DEFTREECODE 71117395Skan 72117395Skan/* Table indexed by tree code giving number of expression 73117395Skan operands beyond the fixed part of the node structure. 74117395Skan Not used for types or decls. */ 75117395Skan 76117395Skan#define DEFTREECODE(SYM, NAME, TYPE, LENGTH) LENGTH, 77117395Skan 78117395Skanconst unsigned char tree_code_length[] = { 79117395Skan#include "tree.def" 80117395Skan 0, 81117395Skan#include "c-common.def" 82117395Skan 0, 83117395Skan#include "cp-tree.def" 84117395Skan}; 85117395Skan#undef DEFTREECODE 86117395Skan 87117395Skan/* Names of tree components. 88117395Skan Used for printing out the tree and error messages. */ 89117395Skan#define DEFTREECODE(SYM, NAME, TYPE, LEN) NAME, 90117395Skan 91117395Skanconst char *const tree_code_name[] = { 92117395Skan#include "tree.def" 93117395Skan "@@dummy", 94117395Skan#include "c-common.def" 95117395Skan "@@dummy", 96117395Skan#include "cp-tree.def" 97117395Skan}; 98117395Skan#undef DEFTREECODE 99117395Skan 100169689Skan/* Lang hook routines common to C++ and ObjC++ appear in cp/cp-objcp-common.c; 101169689Skan there should be very few routines below. */ 102117395Skan 103169689Skan/* The following function does something real, but only in Objective-C++. */ 104117395Skan 105169689Skantree 106169689Skanobjcp_tsubst_copy_and_build (tree t ATTRIBUTE_UNUSED, 107169689Skan tree args ATTRIBUTE_UNUSED, 108169689Skan tsubst_flags_t complain ATTRIBUTE_UNUSED, 109169689Skan tree in_decl ATTRIBUTE_UNUSED, 110169689Skan bool function_p ATTRIBUTE_UNUSED) 11190075Sobrien{ 112169689Skan return NULL_TREE; 11390075Sobrien} 114102780Skan 115117395Skan 116169689Skanstatic void 117169689Skancp_init_ts (void) 118117395Skan{ 119169689Skan tree_contains_struct[NAMESPACE_DECL][TS_DECL_NON_COMMON] = 1; 120169689Skan tree_contains_struct[USING_DECL][TS_DECL_NON_COMMON] = 1; 121169689Skan tree_contains_struct[TEMPLATE_DECL][TS_DECL_NON_COMMON] = 1; 122117395Skan 123169689Skan tree_contains_struct[NAMESPACE_DECL][TS_DECL_WITH_VIS] = 1; 124169689Skan tree_contains_struct[USING_DECL][TS_DECL_WITH_VIS] = 1; 125169689Skan tree_contains_struct[TEMPLATE_DECL][TS_DECL_WITH_VIS] = 1; 126117395Skan 127169689Skan tree_contains_struct[NAMESPACE_DECL][TS_DECL_WRTL] = 1; 128169689Skan tree_contains_struct[USING_DECL][TS_DECL_WRTL] = 1; 129169689Skan tree_contains_struct[TEMPLATE_DECL][TS_DECL_WRTL] = 1; 130117395Skan 131169689Skan tree_contains_struct[NAMESPACE_DECL][TS_DECL_COMMON] = 1; 132169689Skan tree_contains_struct[USING_DECL][TS_DECL_COMMON] = 1; 133169689Skan tree_contains_struct[TEMPLATE_DECL][TS_DECL_COMMON] = 1; 134102780Skan 135169689Skan tree_contains_struct[NAMESPACE_DECL][TS_DECL_MINIMAL] = 1; 136169689Skan tree_contains_struct[USING_DECL][TS_DECL_MINIMAL] = 1; 137169689Skan tree_contains_struct[TEMPLATE_DECL][TS_DECL_MINIMAL] = 1; 138107590Sobrien 139169689Skan init_shadowed_var_for_decl (); 140132718Skan 141107590Sobrien} 142107590Sobrien 143132718Skanvoid 144169689Skanfinish_file (void) 145132718Skan{ 146169689Skan cp_finish_file (); 147132718Skan} 148132718Skan 149169689Skan#include "gtype-cp.h" 150