From: Jason Merrill Date: Thu, 21 Jun 2018 18:19:29 +0000 (-0400) Subject: Let -fmem-report see callers of cxx_make_type. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=6ec04704dfb7425443de886e7f590286ce3b87a0;p=gcc.git Let -fmem-report see callers of cxx_make_type. * lex.c (cxx_make_type): Add MEM_STAT_DECL. (make_class_type): Likewise. (cxx_make_type_hook): New. * cp-objcp-common.h (LANG_HOOKS_MAKE_TYPE): Use cxx_make_type_hook. From-SVN: r261859 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 1ec2382ebcc..55e9e0b0fc3 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,11 @@ +2018-06-21 Jason Merrill + + Let -fmem-report see callers of cxx_make_type. + * lex.c (cxx_make_type): Add MEM_STAT_DECL. + (make_class_type): Likewise. + (cxx_make_type_hook): New. + * cp-objcp-common.h (LANG_HOOKS_MAKE_TYPE): Use cxx_make_type_hook. + 2018-06-20 Nathan Sidwell PR c++/85634 diff --git a/gcc/cp/cp-objcp-common.h b/gcc/cp/cp-objcp-common.h index 18ccc5bb6cf..6f08253f70f 100644 --- a/gcc/cp/cp-objcp-common.h +++ b/gcc/cp/cp-objcp-common.h @@ -34,6 +34,7 @@ extern tree cp_unit_size_without_reusable_padding (tree); extern tree cp_get_global_decls (); extern tree cp_pushdecl (tree); extern void cp_register_dumps (gcc::dump_manager *); +extern tree cxx_make_type_hook (tree_code); /* Lang hooks that are shared between C++ and ObjC++ are defined here. Hooks specific to C++ or ObjC++ go in cp/cp-lang.c and objcp/objcp-lang.c, @@ -126,7 +127,7 @@ extern void cp_register_dumps (gcc::dump_manager *); #define LANG_HOOKS_TREE_DUMP_TYPE_QUALS_FN cp_type_quals #undef LANG_HOOKS_MAKE_TYPE -#define LANG_HOOKS_MAKE_TYPE cxx_make_type +#define LANG_HOOKS_MAKE_TYPE cxx_make_type_hook #undef LANG_HOOKS_TYPE_FOR_MODE #define LANG_HOOKS_TYPE_FOR_MODE c_common_type_for_mode #undef LANG_HOOKS_TYPE_FOR_SIZE diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h index ee9242f9313..0994377e5d7 100644 --- a/gcc/cp/cp-tree.h +++ b/gcc/cp/cp-tree.h @@ -6495,8 +6495,8 @@ extern void retrofit_lang_decl (tree); extern void fit_decomposition_lang_decl (tree, tree); extern tree copy_decl (tree CXX_MEM_STAT_INFO); extern tree copy_type (tree CXX_MEM_STAT_INFO); -extern tree cxx_make_type (enum tree_code); -extern tree make_class_type (enum tree_code); +extern tree cxx_make_type (enum tree_code CXX_MEM_STAT_INFO); +extern tree make_class_type (enum tree_code CXX_MEM_STAT_INFO); extern const char *get_identifier_kind_name (tree); extern void set_identifier_kind (tree, cp_identifier_kind); extern bool cxx_init (void); diff --git a/gcc/cp/lex.c b/gcc/cp/lex.c index c47ae1dd5a1..bd5d507e97b 100644 --- a/gcc/cp/lex.c +++ b/gcc/cp/lex.c @@ -852,9 +852,9 @@ maybe_add_lang_type_raw (tree t) } tree -cxx_make_type (enum tree_code code) +cxx_make_type (enum tree_code code MEM_STAT_DECL) { - tree t = make_node (code); + tree t = make_node (code PASS_MEM_STAT); if (maybe_add_lang_type_raw (t)) { @@ -868,10 +868,18 @@ cxx_make_type (enum tree_code code) return t; } +/* A wrapper without the memory stats for LANG_HOOKS_MAKE_TYPE. */ + +tree +cxx_make_type_hook (enum tree_code code) +{ + return cxx_make_type (code); +} + tree -make_class_type (enum tree_code code) +make_class_type (enum tree_code code MEM_STAT_DECL) { - tree t = cxx_make_type (code); + tree t = cxx_make_type (code PASS_MEM_STAT); SET_CLASS_TYPE_P (t, 1); return t; }