From bc6e01b754d59ad9d08431a06ccd58751510c2ff Mon Sep 17 00:00:00 2001 From: Phil Muldoon Date: Tue, 10 Jan 2017 13:30:24 +0000 Subject: [PATCH] Fix up comments Convert to /* */ style and lightly edit some language. --- gdb/compile/compile-c.h | 8 +- gdb/compile/compile-cplus-symbols.c | 18 +-- gdb/compile/compile-cplus-templates.c | 174 +++++++++++++----------- gdb/compile/compile-cplus-templates.h | 52 +++---- gdb/compile/compile-cplus-types.c | 187 ++++++++++++-------------- gdb/compile/compile-cplus.h | 59 ++++---- gdb/compile/compile-internal.h | 46 +++---- gdb/compile/compile.c | 38 +++--- 8 files changed, 290 insertions(+), 292 deletions(-) diff --git a/gdb/compile/compile-c.h b/gdb/compile/compile-c.h index a14c53da426..7161c603a9b 100644 --- a/gdb/compile/compile-c.h +++ b/gdb/compile/compile-c.h @@ -1,5 +1,5 @@ /* Header file for GDB compile C-language support. - Copyright (C) 2014-2016 Free Software Foundation, Inc. + Copyright (C) 2014-2017 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -68,7 +68,7 @@ class compile_c_instance gcc_type convert_type (struct type *type); - // Plug-in forwards + /* Plug-in forwards */ unsigned int c_version () const; @@ -140,7 +140,7 @@ class compile_c_instance private: - // The GCC C context. + /* The GCC C context. */ struct gcc_c_context *m_context; }; @@ -173,4 +173,4 @@ extern char *c_get_range_decl_name (const struct dynamic_prop *prop); extern char *c_symbol_substitution_name (struct symbol *sym); -#endif // GDB_COMPILE_C_H +#endif /* GDB_COMPILE_C_H */ diff --git a/gdb/compile/compile-cplus-symbols.c b/gdb/compile/compile-cplus-symbols.c index 431d59986b8..f33937b9ee2 100644 --- a/gdb/compile/compile-cplus-symbols.c +++ b/gdb/compile/compile-cplus-symbols.c @@ -1,6 +1,6 @@ /* Convert symbols from GDB to GCC - Copyright (C) 2014-2016 Free Software Foundation, Inc. + Copyright (C) 2014-2017 Free Software Foundation, Inc. This file is part of GDB. @@ -33,13 +33,13 @@ #include "dwarf2loc.h" #include "cp-support.h" #include "gdbcmd.h" -#include "compile-c.h" // !!keiths FIXME for c_get_range_decl_name +#include "compile-c.h" /* !!keiths FIXME for c_get_range_decl_name */ using namespace compile; -// See description in compile-internal.h. +/* See description in compile-internal.h. */ int debug_compile_oracle = 0; @@ -78,7 +78,7 @@ convert_one_symbol (compile_cplus_instance *instance, std::string name; char *symbol_name = NULL; - // Add a null cleanup for templates. !!keiths: remove! + /* Add a null cleanup for templates. !!keiths: remove! */ struct cleanup *back_to = make_cleanup (free_current_contents, &symbol_name); @@ -275,7 +275,7 @@ convert_one_symbol (compile_cplus_instance *instance, symbol_name, addr, filename, line); } - // Pop scope for non-local symbols. + /* Pop scope for non-local symbols. */ if (!is_local) instance->leave_scope (); } @@ -389,10 +389,10 @@ convert_symbol_bmsym (compile_cplus_instance *instance, sym_type = instance->convert_type (type); instance->push_namespace (""); - // FIXME: push (and, after the call, pop) any other namespaces, if - // any, and drop the above when defining a class member. drop any - // namespace and class names from before the symbol name, and any - // function signatures from after it. -lxo + /* FIXME: push (and, after the call, pop) any other namespaces, if + any, and drop the above when defining a class member. drop any + namespace and class names from before the symbol name, and any + function signatures from after it. -lxo */ /* !!keiths: I don't see how we could do this. We have NO debug information for the symbol. While we have access to the demangled name, we still don't know what A::B::C::D::E::F means without debug diff --git a/gdb/compile/compile-cplus-templates.c b/gdb/compile/compile-cplus-templates.c index ef7c9fa1ced..0dd03c440f6 100644 --- a/gdb/compile/compile-cplus-templates.c +++ b/gdb/compile/compile-cplus-templates.c @@ -1,6 +1,6 @@ /* Template support for compile. - Copyright (C) 2016 Free Software Foundation, Inc. + Copyright (C) 2016, 2017 Free Software Foundation, Inc. This file is part of GDB. @@ -36,30 +36,31 @@ using namespace compile; enum template_parameter_type_modifier { - // The abstract parameter type is not qualified at all. + /*/ The abstract parameter type is not qualified at all. */ PARAMETER_NONE, - // The abstract parameter type was declared `const', const T. + /* The abstract parameter type was declared `const', const T. */ PARAMETER_CONST, - // The abstract parameter type was declared `volatile', volatile T. + /* The abstract parameter type was declared `volatile', volatile T. */ PARAMETER_VOLATILE, - // The abstract parameter type was declared `restrict', restrict T. + /* The abstract parameter type was declared `restrict', restrict T. */ PARAMETER_RESTRICT, - // The abstract parameter type was declared as a pointer, T*. + /* The abstract parameter type was declared as a pointer, T*. */ PARAMETER_POINTER, - // The abstract parameter type was declared as a reference, T&. + /* The abstract parameter type was declared as a reference, T&. */ PARAMETER_LVALUE_REFERENCE, - // The abstract parameter type was declared as rvalue reference, T&&. + /* The abstract parameter type was declared as rvalue reference, + T&&. */ PARAMETER_RVALUE_REFERENCE }; typedef enum template_parameter_type_modifier template_parameter_modifier; -// Forward declarations +/* Forward declarations. */ static void print_template_parameter_list (struct ui_file *stream, const struct template_argument_info *arg_info); @@ -76,7 +77,7 @@ static void print_function_template_arglist (const struct demangle_component *comp, const struct template_symbol *tsymbol, struct ui_file *stream); -// See description in compile-cplus-templates.h. +/* See description in compile-cplus-templates.h. */ function_template_defn::function_template_defn (std::string generic, parsed_demangle_info info, @@ -170,7 +171,8 @@ function_template_decl (const struct template_symbol *tsymbol, return str; } -// Compute the generic used by the given function template definition. +/* Compute the generic used by the given function template + definition. */ static std::string compute_function_template_generic (struct template_symbol *tsymbol, @@ -178,21 +180,23 @@ compute_function_template_generic (struct template_symbol *tsymbol, { gdb_assert (info.tree () != NULL); - // Make sure template arguments have been decoded. + /* Ensure template arguments have been decoded. */ cp_decode_template_type_indices (tsymbol, info.info ()); - // Output the template generic. + /* Output the template generic. */ char *generic_c = function_template_decl (tsymbol, info.info ()); std::string generic (generic_c); xfree (generic_c); return generic; } -// See description in compile-cplus.h. +/* See description in compile-cplus.h. */ void compile_cplus_instance::maybe_define_new_function_template - (const struct symbol *sym, struct type *parent_type, int f_idx, int m_idx) + (const struct symbol *sym, struct type *parent_type, int f_idx, + int m_idx) + { if (sym != NULL && SYMBOL_IS_CPLUS_TEMPLATE_FUNCTION (sym)) { @@ -211,7 +215,8 @@ compile_cplus_instance::maybe_define_new_function_template if (pos == m_function_template_defns->end ()) { - // New template definition -- insert it into the cache. + /* Create the new template definition and insert it into + the cache. */ defn = new function_template_defn (generic, info, tsym, parent_type, f_idx, m_idx); m_function_template_defns->insert @@ -219,7 +224,7 @@ compile_cplus_instance::maybe_define_new_function_template } else { - // Use the existing definition. + /* Or use the existing definition. */ defn = pos->second.get (); } @@ -242,7 +247,7 @@ compile_cplus_instance::maybe_define_new_function_template } } -// See description in compile-cplus-templates.h. +/* See description in compile-cplus-templates.h. */ void compile::define_templates (compile_cplus_instance *instance, @@ -270,7 +275,7 @@ compile::define_templates (compile_cplus_instance *instance, instance->emit_class_template_decls (); } -// See description in compile-cplus-templates.h. +/* See description in compile-cplus-templates.h. */ function_template_defn * compile_cplus_instance::find_function_template_defn @@ -287,15 +292,16 @@ compile_cplus_instance::find_function_template_defn = m_function_template_defns->find (generic); if (pos != m_function_template_defns->end ()) { - // A template generic for this was already defined. + /* A template generic for this was already defined. */ return pos->second.get (); } - // No generic for this template was found. + /* No generic for this template was found. */ return NULL; } -// Compute the generic used by the given function template definition. +/* Compute the generic used by the given function template + definition. */ static std::string compute_class_template_generic (std::string name, struct type *type) @@ -303,7 +309,7 @@ compute_class_template_generic (std::string name, struct type *type) struct ui_file *stream = mem_fileopen (); struct cleanup *back_to = make_cleanup_ui_file_delete (stream); - // Format: class|struct|union NAME + /* Format: class|struct|union NAME */ if (TYPE_CODE (type) == TYPE_CODE_STRUCT) { if (TYPE_DECLARED_CLASS (type)) @@ -331,7 +337,7 @@ compute_class_template_generic (std::string name, struct type *type) return string_generic; } -// See description in compile-cplus-templates.h. +/* See description in compile-cplus-templates.h. */ class_template_defn * compile_cplus_instance::find_class_template_defn (struct type *type) @@ -359,18 +365,18 @@ compile_cplus_instance::find_class_template_defn (struct type *type) return NULL; } -// A class providing printing for a single parameter type modifier. +/* A class providing printing for a single parameter type modifier. */ class one_template_type_modifier_printer { public: - // Construct a new printer which outputs to STREAM. + /* Construct a new printer which outputs to STREAM. */ explicit one_template_type_modifier_printer (struct ui_file *stream) : m_stream (stream) { } - // Unary function to output the modifier. + /* Unary function to output the modifier. */ void operator() (template_parameter_modifier modifier) { switch (modifier) @@ -407,11 +413,11 @@ public: } private: - // The stream to which to print the modifier. + /* The stream to which to print the modifier. */ struct ui_file *m_stream; }; -// Print the type modifiers MODIFIERS to STREAM. +/* Print the type modifiers MODIFIERS to STREAM. */ static void print_template_type_modifiers @@ -482,7 +488,7 @@ print_template_type (const struct demangle_component *comp, const struct template_symbol *tsymbol, struct ui_file *stream) { - // Get the template parameter and modifiers. + /* Get the template parameter and modifiers. */ std::vector modifiers; comp = get_template_type (comp, modifiers); @@ -498,7 +504,7 @@ print_template_type (const struct demangle_component *comp, print_template_type_modifiers (modifiers, stream); } -// Print the template parameter list of a type/symbol to STREAM. +/* Print the template parameter list of a type/symbol to STREAM. */ static void print_template_parameter_list (struct ui_file *stream, @@ -563,7 +569,7 @@ print_function_template_arglist (const struct demangle_component *comp, tidx = tsymbol->template_argument_indices[i - artificials]; if (tidx == -1) { - // A concrete type was used to define this argument. + /* A concrete type was used to define this argument. */ c_print_type (TYPE_FIELD_TYPE (ttype, i), "", stream, -1, 0, &type_print_raw_options); continue; @@ -572,7 +578,7 @@ print_function_template_arglist (const struct demangle_component *comp, /* The type of this argument was specified by a template parameter, possibly with added CV and ref qualifiers. */ - // Get the next ARGLIST node and print it. + /* Get the next ARGLIST node and print it. */ comp = d_right (comp); gdb_assert (comp != NULL); gdb_assert (comp->type == DEMANGLE_COMPONENT_ARGLIST); @@ -599,7 +605,7 @@ print_conversion_node (const struct demangle_component *comp, case DEMANGLE_COMPONENT_QUAL_NAME: { - // Print out the qualified name. + /* Print out the qualified name. */ struct cleanup *back_to; char *ret = cp_comp_to_string (d_left (comp), 10); @@ -607,7 +613,7 @@ print_conversion_node (const struct demangle_component *comp, fprintf_unfiltered (stream, "%s::", ret); do_cleanups (back_to); - // Follow the rest of the name. + /* Follow the rest of the name. */ comp = d_right (comp); } break; @@ -623,7 +629,7 @@ print_conversion_node (const struct demangle_component *comp, } } -// See description in compile-cplus-templates.h. +/* See description in compile-cplus-templates.h. */ void compile_cplus_instance::maybe_define_new_class_template @@ -640,18 +646,18 @@ compile_cplus_instance::maybe_define_new_class_template if (pos == m_class_template_defns->end ()) { - // New template definition -- insert it into the cache. + /* Insert the new template definition into the cache. */ defn = new class_template_defn (decl_name, generic, type); m_class_template_defns->insert (std::make_pair (generic, defn)); } else { - // Existing definition. Use the existing definition. + /* If there is an existing definition, use that definition. */ defn = pos->second.get (); } - // Loop over the template arguments, noting any default values. + /* Loop over the template arguments, noting any default values. */ for (unsigned int i = 0; i < TYPE_N_TEMPLATE_ARGUMENTS (type); ++i) { if (defn->default_argument (i) == NULL @@ -668,7 +674,7 @@ compile_cplus_instance::maybe_define_new_class_template } } -// See description in compile-cplus-templates.h. +/* See description in compile-cplus-templates.h. */ void compile::scan_type_for_function_templates (compile_cplus_instance *instance, @@ -795,11 +801,11 @@ define_template_parameters_generic break; case template_parameter: - // GDB doesn't support template-template parameters. + /* GDB doesn't support template-template parameters. */ break; case variadic_parameter: - // GDB doesn't support variadic templates. + /* GDB doesn't support variadic templates. */ break; default: @@ -808,7 +814,7 @@ define_template_parameters_generic } } -// Fill in the `kinds' member of DEST from ARG_INFO. +/* Populate the `kinds' member of DEST from ARG_INFO. */ static void enumerate_template_parameter_kinds @@ -837,7 +843,7 @@ enumerate_template_parameter_kinds } } -// See description in compile-cplus-templates.h. +/* See description in compile-cplus-templates.h. */ void compile_cplus_instance::enumerate_template_arguments @@ -912,7 +918,7 @@ define_default_template_parameter_types } } -// A class to add type modifiers to a given compiler type. +/* A class to add type modifiers to a given compiler type. */ class template_parameter_type_modifier_adder { @@ -965,7 +971,7 @@ public: } } - // Returns the modified type. + /* Returns the modified type. */ gcc_type type () const { @@ -973,17 +979,17 @@ public: } private: - // The compiler instance into which to define the new type(s). + /* The compiler instance into which to define the new type(s). */ compile_cplus_instance *m_instance; - // The qualifier flags. + /* The qualifier flags. */ gcc_cp_qualifiers_flags m_flags; - // The type we are modifying. + /* The type we are modifying. */ gcc_type m_type; }; -// Add the modifiers given by MODIFIERS to TYPE. +/* Add the modifiers given by MODIFIERS to TYPE. */ static gcc_type add_template_type_modifiers @@ -997,7 +1003,7 @@ add_template_type_modifiers return adder.type (); } -// Add the type modifiers described in COMP to BASE_TYPE. +/* Add the type modifiers described in COMP to BASE_TYPE. */ static gcc_type add_type_modifiers (compile_cplus_instance *instance, @@ -1036,7 +1042,7 @@ class function_template_definer return; } - // Make sure we only do this once. + /* Ensure this is one-time operation. */ defn->set_defined (true); struct fn_field *method_field; @@ -1082,11 +1088,11 @@ class function_template_definer if (name != id) sym_kind |= GCC_CP_FLAG_SPECIAL_FUNCTION; - // Define any default value types. + /* Define any default value types. */ define_default_template_parameter_types (m_instance, defn, tsym->template_arguments); - // Assess the processing context. + /* Assess the processing context. */ gcc_type result; compile_scope scope = m_instance->new_scope (SYMBOL_NATURAL_NAME (&tsym->base), @@ -1101,17 +1107,17 @@ class function_template_definer return; } - // Start the new template declaration. + /* Start the new template declaration. */ m_instance->enter_scope (scope); m_instance->start_new_template_decl (defn->generic ().c_str ()); - // Get the parameters' generic kinds and types. + /* Get the parameters' generic kinds and types. */ define_template_parameters_generic (m_instance, defn, tsym->template_arguments, symbol_symtab (&tsym->base)->filename, SYMBOL_LINE (&tsym->base)); - // Find the function node describing this template function. + /* Find the function node describing this template function. */ gdb_assert (defn->demangle_info ()->tree ()->type == DEMANGLE_COMPONENT_TYPED_NAME); struct demangle_component *comp = d_right (defn->demangle_info ()->tree ()); @@ -1173,7 +1179,7 @@ class function_template_definer return_type = m_instance->convert_type (temp); } - // Get the parameters' definitions, and put them into ARRAY. + /* Get the parameters' definitions, and put them into ARRAY. */ struct type *templ_type = SYMBOL_TYPE (&tsym->base); int is_varargs = is_varargs_p (templ_type); struct gcc_type_array array; @@ -1184,7 +1190,7 @@ class function_template_definer int artificials = 0; - // d_right (info->tree) is FUNCTION_TYPE (assert above). + /* d_right (info->tree) is FUNCTION_TYPE (assert above). */ comp = d_right (d_right (defn->demangle_info ()->tree ())); gdb_assert (comp != NULL && comp->type == DEMANGLE_COMPONENT_ARGLIST); @@ -1202,13 +1208,13 @@ class function_template_definer if (tidx == -1) { - // The parameter's type is a concrete type. + /* The parameter's type is a concrete type. */ array.elements[i - artificials] = m_instance->convert_type (arg_type); } else { - // The parameter's type is a template parameter. + /* The parameter's type is a template parameter. */ gcc_type result = defn->parameter_abstract_type (tidx); array.elements[i - artificials] @@ -1236,7 +1242,7 @@ class function_template_definer cache. */ class_type = m_instance->convert_type (defn->parent_type ()); - // Add any virtuality flags. + /* Add any virtuality flags. */ if (TYPE_FN_FIELD_VIRTUAL_P (methods, defn->midx ())) { sym_kind |= GCC_CP_FLAG_VIRTUAL_FUNCTION; @@ -1254,25 +1260,25 @@ class function_template_definer } } - // Add access flags. + /* Add access flags. */ sym_kind |= get_method_access_flag (defn->parent_type (), defn->fidx (), defn->midx ()); - // Create the method type. + /* Create the method type. */ if (!TYPE_FN_FIELD_STATIC_P (methods, defn->midx ())) { gcc_cp_qualifiers_flags quals; gcc_cp_ref_qualifiers_flags rquals; - quals = (enum gcc_cp_qualifiers) 0; // !!keiths FIXME - rquals = GCC_CP_REF_QUAL_NONE; // !!keiths FIXME + quals = (enum gcc_cp_qualifiers) 0; /* !!keiths FIXME */ + rquals = GCC_CP_REF_QUAL_NONE; /* !!keiths FIXME */ func_type = m_instance->build_method_type (class_type, func_type, quals, rquals); } } - // Finally, define the new generic template declaration. + /* Finally, define the new generic template declaration. */ gcc_decl decl = m_instance->new_decl ("function template", name, sym_kind, func_type, 0, 0, @@ -1286,11 +1292,11 @@ class function_template_definer private: - // The compiler instance to use. + /* The compiler instance to use. */ compile_cplus_instance *m_instance; }; -// See description in compile-cplus-templates.h. +/* See description in compile-cplus-templates.h. */ void compile_cplus_instance::emit_function_template_decls () @@ -1301,7 +1307,7 @@ compile_cplus_instance::emit_function_template_decls () definer (item.second.get ()); } -// A class to define and fill-in class template definitions. +/* A class to define and fill-in class template definitions. */ class class_template_definer { @@ -1321,16 +1327,16 @@ class class_template_definer return; } - // Make sure this is only done once! + /* Make sure this is only done once! */ defn->set_defined (true); - // Define any default value types. + /* Define any default value types. */ const struct template_argument_info *arg_info = TYPE_TEMPLATE_ARGUMENT_INFO (defn->type ()); define_default_template_parameter_types (m_instance, defn, arg_info); - // Create/push new scope. + /* Create/push new scope. */ compile_scope scope = m_instance->new_scope (defn->decl_name (), defn->type ()); @@ -1343,15 +1349,19 @@ class class_template_definer } m_instance->enter_scope (scope); - // Now start a new template list for this template. + /* Start a new template list for this template. */ m_instance->start_new_template_decl (defn->generic ().c_str ()); - // Get the parameters' generic kinds and types. + /* Get the parameters' generic kinds and types. */ define_template_parameters_generic (m_instance, defn, arg_info, - /* filename */ NULL, // !!keiths FIXME - /* line */ 0); // !!keiths FIXME + /* filename */ NULL, /* + !!keiths FIXME */ + /* line */ 0 + /* !!keiths FIXME */ + ); - // Define the new generic template declaration. + + /* Define the new generic template declaration. */ if (TYPE_CODE (defn->type ()) == TYPE_CODE_STRUCT) { gcc_decl decl @@ -1363,7 +1373,7 @@ class class_template_definer 0, NULL, 0, /*filename*/ NULL, /*line*/ 0); defn->set_decl (decl); - } + } else { gdb_assert (TYPE_CODE (defn->type ()) == TYPE_CODE_UNION); @@ -1380,11 +1390,11 @@ class class_template_definer private: - // The compiler instance to use. + /* The compiler instance to use. */ compile_cplus_instance *m_instance; }; -// See description in compile-cplus-templates.h. +/* See description in compile-cplus-templates.h. */ void compile_cplus_instance::emit_class_template_decls () @@ -1395,7 +1405,7 @@ compile_cplus_instance::emit_class_template_decls () definer (item.second.get ()); } -// A command to test function_template_decl. +/* A command to test function_template_decl. */ static void print_template_defn_command (char *arg, int from_tty) diff --git a/gdb/compile/compile-cplus-templates.h b/gdb/compile/compile-cplus-templates.h index 3707e1dd67e..433afc6eb6f 100644 --- a/gdb/compile/compile-cplus-templates.h +++ b/gdb/compile/compile-cplus-templates.h @@ -1,6 +1,6 @@ /* Template support for compile. - Copyright (C) 2016 Free Software Foundation, Inc. + Copyright (C) 2016, 2017 Free Software Foundation, Inc. This file is part of GDB. @@ -37,7 +37,7 @@ namespace compile class class_template_defn; class compile_cplus_instance; - // Types used for tracking template definitions. + /* Types used for tracking template definitions. */ typedef std::unique_ptr function_template_defn_up; typedef std::unique_ptr class_template_defn_up; typedef std::pair @@ -49,13 +49,13 @@ namespace compile typedef std::unordered_map class_template_defn_map_t; - // A base class holding data common to all template definitions. + /* A base class holding data common to all template definitions. */ class template_defn { public: - // Return the declaration name of this definition. + /* Return the declaration name of this definition. */ const char * decl_name () const @@ -63,7 +63,7 @@ namespace compile return m_decl_name.c_str (); } - // Return the compiler plug-in's decl for this definition. + /* Return the compiler plug-in's decl for this definition. */ gcc_decl decl () const @@ -71,7 +71,7 @@ namespace compile return m_decl; } - // Set the compiler plug-in's decl for this definition. + /* Set the compiler plug-in's decl for this definition. */ void set_decl (gcc_decl decl) @@ -79,7 +79,7 @@ namespace compile m_decl = decl; } - // Return the generic string for this template definition. + /* Return the generic string for this template definition. */ const std::string generic (void) const @@ -96,7 +96,7 @@ namespace compile return m_abstract_types[idx]; } - // Set the IDX'th template parameter's abstract type. + /* Set the IDX'th template parameter's abstract type. */ void set_parameter_abstract_type (unsigned int idx, gcc_type type) @@ -104,7 +104,7 @@ namespace compile m_abstract_types[idx] = type; } - // Has this template already been defined in the compiler plug-in? + /* Has this template already been defined in the compiler plug-in? */ bool defined (void) const @@ -112,7 +112,7 @@ namespace compile return m_defined; } - // Mark this definition as defined in the compiler plug-in. + /* Mark this definition as defined in the compiler plug-in. */ void set_defined (bool val) @@ -129,7 +129,7 @@ namespace compile return m_default_arguments[arg_num]; } - // Record the value of the ARG_NUM'th template parameter. + /* Record the value of the ARG_NUM'th template parameter. */ void set_default_argument (unsigned int arg_num, struct symbol *value) @@ -157,19 +157,20 @@ namespace compile private: - // The declaration name of the template, excluding any parameters. + /* The declaration name of the template, excluding any + parameters. */ std::string m_decl_name; - // A string representation of the generic template definition. + /* A string representation of the generic template definition. */ std::string m_generic; - // The abstract template parameter types. + /* The abstract template parameter types. */ std::vector m_abstract_types; - // The decl associated with this template definition. + /* The decl associated with this template definition. */ gcc_decl m_decl; - // A list of default values for the parameters of this template. + /* A list of default values for the parameters of this template. */ std::vector m_default_arguments; /* Has this template already been defined? This is a necessary evil @@ -177,7 +178,7 @@ namespace compile bool m_defined; }; - // A function template definition. + /* A function template definition. */ class function_template_defn : public template_defn @@ -199,14 +200,14 @@ namespace compile const struct template_symbol *tsymbol, struct type *parent_type, int fidx, int midx); - // Return the demangle information for this template. + /* Return the demangle information for this template. */ const parsed_demangle_info *demangle_info (void) const { return &m_demangle_info; } - // Return the concrete instance used to define this template. + /* Return the concrete instance used to define this template. */ const struct template_symbol *template_symbol (void) const { @@ -248,7 +249,7 @@ namespace compile const struct template_symbol *m_tsymbol; - // The parent type or NULL if this does not represent a method. + /* The parent type or NULL if this does not represent a method. */ struct type *m_parent_type; @@ -258,18 +259,18 @@ namespace compile int m_fidx; int m_midx; - // Demangle tree for the template defining this generic. + /* Demangle tree for the template defining this generic. */ parsed_demangle_info m_demangle_info; }; - // A class template definition. + /* A class template definition. */ class class_template_defn : public template_defn { public: - // A unary function to delete map items. + /* A unary function to delete map items. */ static void destroy (class_template_map_item_t p); @@ -284,7 +285,8 @@ namespace compile { } - // Return concrete instance that this template definition was based on. + /* Return concrete instance that this template definition was + based on. */ struct type *type (void) const { @@ -313,4 +315,4 @@ namespace compile void scan_type_for_function_templates (compile_cplus_instance *instance, struct type *type); }; -#endif // COMPILE_CPLUS_TEMPLATES_H +#endif /* COMPILE_CPLUS_TEMPLATES_H */ diff --git a/gdb/compile/compile-cplus-types.c b/gdb/compile/compile-cplus-types.c index 62d75459ffc..b313d5caf21 100644 --- a/gdb/compile/compile-cplus-types.c +++ b/gdb/compile/compile-cplus-types.c @@ -1,6 +1,6 @@ /* Convert types from GDB to GCC - Copyright (C) 2014-2016 Free Software Foundation, Inc. + Copyright (C) 2014-2017 Free Software Foundation, Inc. This file is part of GDB. @@ -32,7 +32,8 @@ #include "block.h" #include "gdbcmd.h" #include "c-lang.h" -#include "compile-c.h" // for c_get_range_decl_name et al +#include "compile-c.h" /* Included for c_get_range_decl_name + et al. */ #include @@ -62,7 +63,7 @@ static int debug_compile_cplus_scopes = 0; static gcc_type ccp_convert_func (compile_cplus_instance *instance, struct type *type, int strip_artificial); -// See description in compile-cplus.h. +/* See description in compile-cplus.h. */ char * compile::decl_name (const char *natural) @@ -97,7 +98,7 @@ compile::decl_name (const char *natural) return name; } -// See description in compile-cplus.h. +/* See description in compile-cplus.h. */ int compile::is_varargs_p (const struct type *type) @@ -209,19 +210,19 @@ ccp_type_name_to_scope (const char *type_name, const struct block *block) while (1) { - // Create a string token of the first component of TYPE_NAME. + /* Create a string token of the first component of TYPE_NAME. */ int len = cp_find_first_component (p); std::string s (p, len); - // Advance past the last token. + /* Advance past the last token. */ p += len; - // Look up the symbol and decide when to stop. + /* Look up the symbol and decide when to stop. */ if (!lookup_name.empty ()) lookup_name += "::"; lookup_name += s; - // Lookup the resulting name. + /* Look up the resulting name. */ struct block_symbol bsymbol = lookup_symbol (lookup_name.c_str (), block, VAR_DOMAIN, NULL); @@ -314,7 +315,7 @@ compile::operator!= (const compile_scope &lhs, const compile_scope &rhs) return false; } -// See description in compile-cplus.h. +/* See description in compile-cplus.h. */ void compile_cplus_instance::enter_scope (compile_scope &new_scope) @@ -323,7 +324,7 @@ compile_cplus_instance::enter_scope (compile_scope &new_scope) new_scope.m_pushed = must_push; - // Save the new scope. + /* Save the new scope. */ m_scopes.push_back (new_scope); if (must_push) @@ -331,7 +332,7 @@ compile_cplus_instance::enter_scope (compile_scope &new_scope) if (debug_compile_cplus_scopes) printf_unfiltered ("entering new scope %p\n", new_scope); - // Push the global namespace. + /* Push the global namespace. */ push_namespace (""); /* Push all other namespaces. Note that we do not push the last @@ -358,12 +359,13 @@ compile_cplus_instance::enter_scope (compile_scope &new_scope) } } -// See description in compile-cplus.h. +/* See description in compile-cplus.h. */ void compile_cplus_instance::leave_scope () { - // Get the current scope and remove it from the internal list of scopes. + /* Get the current scope and remove it from the internal list of + scopes. */ compile_scope current = m_scopes.back (); m_scopes.pop_back (); @@ -382,7 +384,7 @@ compile_cplus_instance::leave_scope () this->pop_namespace (comp.name.c_str ()); }); - // Pop global namespace. + /* Pop global namespace. */ pop_namespace (""); } else @@ -392,7 +394,7 @@ compile_cplus_instance::leave_scope () } } -// See description in compile-cplus.h. +/*See description in compile-cplus.h. */ compile_scope compile_cplus_instance::new_scope (const char *type_name, struct type *type) @@ -432,7 +434,7 @@ compile_cplus_instance::new_scope (const char *type_name, struct type *type) { if (TYPE_NAME (type) == NULL) { - // Anonymous type + /* Anonymous type */ /* We don't have a qualified name for this to look up, but we need a scope. We have to assume, then, that it is the same @@ -460,12 +462,12 @@ compile_cplus_instance::new_scope (const char *type_name, struct type *type) } } - // There had better be at least one component in the scope! + /* Ensure least one component in the scope. */ gdb_assert (scope.size () > 0); return scope; } -// !!keiths: not RVALUE REFERENCES! +/* !!keiths: not RVALUE REFERENCES! */ gcc_type compile::convert_reference_base (compile_cplus_instance *instance, @@ -487,7 +489,7 @@ ccp_convert_reference (compile_cplus_instance *instance, return convert_reference_base (instance, target); } -// See description in compile-cplus.h. +/* See description in compile-cplus.h. */ gcc_type compile::convert_pointer_base (compile_cplus_instance *instance, @@ -590,19 +592,20 @@ ccp_convert_typedef (compile_cplus_instance *instance, make_cleanup (xfree, name); } - // Make sure the scope for this type has been pushed. + /* Make sure the scope for this type has been pushed. */ instance->enter_scope (scope); - // Convert the typedef's real type. + /* Convert the typedef's real type. */ gcc_type typedef_type = instance->convert_type (check_typedef (type)); instance->new_decl ("typedef", name, GCC_CP_SYMBOL_TYPEDEF | nested_access, typedef_type, - 0, 0, // !!keiths: Wow. More of this! + 0, 0, + /* !!keiths: Wow. More of this! */ NULL, 0); - // Done with this scope. + /* Completed this scope. */ instance->leave_scope (); do_cleanups (cleanups); return typedef_type; @@ -680,10 +683,6 @@ ccp_convert_struct_or_union_members (compile_cplus_instance *instance, (GCC_CP_SYMBOL_VARIABLE | get_field_access_flag (type, i)), field_type, NULL, physaddr, - // FIXME: do we have - // location info for - // static data members? - // -lxo NULL, 0); } break; @@ -764,12 +763,13 @@ ccp_convert_method (compile_cplus_instance *instance, quals |= GCC_CP_QUALIFIER_VOLATILE; if (TYPE_RESTRICT (method_type)) quals |= GCC_CP_QUALIFIER_RESTRICT; - rquals = GCC_CP_REF_QUAL_NONE; // !!keiths FIXME + rquals = GCC_CP_REF_QUAL_NONE; + /* !!keiths FIXME */ result = instance->build_method_type (class_type, func_type, quals, rquals); return result; } -// Convert a member or method pointer represented by TYPE. +/* Convert a member or method pointer represented by TYPE. */ static gcc_type ccp_convert_memberptr (compile_cplus_instance *instance, struct type *type) @@ -1150,7 +1150,7 @@ ccp_convert_struct_or_union_methods (compile_cplus_instance *instance, struct block_symbol sym; const char *filename; unsigned int line; - const char *kind; //debug + const char *kind; gcc_cp_symbol_kind_flags sym_kind = GCC_CP_SYMBOL_FUNCTION; const char *name; char *special_name; @@ -1301,7 +1301,7 @@ ccp_convert_struct_or_union (compile_cplus_instance *instance, const char *filename = NULL; /* !!keiths: FIXME */ unsigned short line = 0; - // Get the decl name of this type. + /* Get the decl name of this type. */ std::string name; if (TYPE_NAME (type) != NULL) { @@ -1331,7 +1331,7 @@ ccp_convert_struct_or_union (compile_cplus_instance *instance, instance->maybe_define_new_class_template (type, name.c_str ()); instance->emit_class_template_decls (); - // Create a new scope for TYPE. + /* Create a new scope for TYPE. */ compile_scope scope = instance->new_scope (TYPE_NAME (type), type); if (scope.nested_type () != GCC_TYPE_NONE) @@ -1341,7 +1341,7 @@ ccp_convert_struct_or_union (compile_cplus_instance *instance, return scope.nested_type (); } - // Push all scopes. + /* Push all scopes. */ instance->enter_scope (scope); /* First we create the resulting type and enter it into our hash @@ -1427,12 +1427,10 @@ ccp_convert_struct_or_union (compile_cplus_instance *instance, /* Add members. */ ccp_convert_struct_or_union_members (instance, type, result); - /* FIXME: add friend declarations. -lxo */ - /* All finished. */ instance->finish_record_or_union (name.c_str (), TYPE_LENGTH (type)); - // Pop all scopes. + /* Pop all scopes. */ instance->leave_scope (); return result; } @@ -1455,7 +1453,7 @@ ccp_convert_enum (compile_cplus_instance *instance, struct type *type, being unable to convert enum values from '(MyEnum)0' to 'int'. */ int scoped_enum_p = /*TYPE_DECLARED_CLASS (type) ? TRUE :*/ FALSE; - // Create a new scope for this type. + /* Create a new scope for this type. */ compile_scope scope = instance->new_scope (TYPE_NAME (type), type); if (scope.nested_type () != GCC_TYPE_NONE) @@ -1465,7 +1463,7 @@ ccp_convert_enum (compile_cplus_instance *instance, struct type *type, return scope.nested_type (); } - // Create an empty cleanup chain. + /* Create an empty cleanup chain. */ cleanups = make_cleanup (null_cleanup, NULL); if (TYPE_NAME (type) != NULL) @@ -1476,7 +1474,7 @@ ccp_convert_enum (compile_cplus_instance *instance, struct type *type, else name = "anonymous enum"; - // Push all scopes. + /* Push all scopes. */ instance->enter_scope (scope); int_type = instance->int_type (TYPE_UNSIGNED (type), @@ -1506,7 +1504,7 @@ ccp_convert_enum (compile_cplus_instance *instance, struct type *type, instance->finish_enum_type (result); - // Pop all scopes. + /* Pop all scopes. */ instance->leave_scope (); do_cleanups (cleanups); return result; @@ -1595,7 +1593,7 @@ ccp_convert_bool (compile_cplus_instance *instance, struct type *type) return instance->bool_type (); } -// See description in compile-cplus.h. +/* See description in compile-cplus.h. */ gcc_type compile::convert_qualified_base (compile_cplus_instance *instance, @@ -1663,18 +1661,18 @@ ccp_convert_namespace (compile_cplus_instance *instance, else name = ""; - // Push scope. + /* Push scope. */ instance->enter_scope (scope); - // Convert this namespace. + /* Convert this namespace. */ instance->push_namespace (name); instance->pop_namespace (name); - // Pop scope. + /* Pop scope. */ instance->leave_scope (); do_cleanups (cleanups); - // Namespaces are non-cacheable "types." + /* Namespaces are non-cacheable types. */ return DONT_CACHE_TYPE; } @@ -1782,30 +1780,11 @@ compile_cplus_instance::convert_type (struct type *type, -// See compile-cplus.h. +/* See compile-cplus.h. */ compile_cplus_instance::compile_cplus_instance (struct gcc_cp_context *gcc_fe) : compile_instance (&gcc_fe->base, - "-std=gnu++11" - /* We don't need this any more, - the user expression function - is regarded as a friend of - every class, so that GDB users - get to access private and - protected members. - - " -fno-access-control" - - */ - /* Otherwise the .o file may need - "_Unwind_Resume" and - "__gcc_personality_v0". - - ??? Why would that be a - problem? -lxo - - " -fno-exceptions" - */), + "-std=gnu++11"), m_context (gcc_fe), m_function_template_defns (new function_template_defn_map_t ()), m_class_template_defns (new class_template_defn_map_t ()) @@ -1817,9 +1796,9 @@ compile_cplus_instance::compile_cplus_instance (struct gcc_cp_context *gcc_fe) this); } -// Plug-in forwards +/* Plug-in forwards. */ -// A result printer for plug-in calls that return a boolean result. +/* A result printer for plug-in calls that return a boolean result. */ static void ccp_output_result (int result) @@ -1827,7 +1806,8 @@ ccp_output_result (int result) printf_unfiltered ("%s\n", result ? "true" : "false"); } -// A result printer for plug-in calls that return a gcc_type or gcc_decl. +/* A result printer for plug-in calls that return a gcc_type or + gcc_decl. */ static void ccp_output_result (gcc_type result) @@ -1864,7 +1844,7 @@ ccp_output_result (gcc_type result) return result; \ }; -// See description in gcc-cp-fe.def. +/* See description in gcc-cp-fe.def. */ bool compile_cplus_instance::build_constant (gcc_type type, const char *name, @@ -1877,7 +1857,7 @@ compile_cplus_instance::build_constant (gcc_type type, const char *name, return forward ("\"%s\"", name); } -// See description in gcc-cp-fe.def. +/* See description in gcc-cp-fe.def. */ gcc_decl compile_cplus_instance::specialize_function_template @@ -1887,7 +1867,7 @@ compile_cplus_instance::specialize_function_template function_template_defn *defn = find_function_template_defn (concrete); - // A generic should already have been defined. + /* A generic should already have been defined at this point. */ gdb_assert (defn != NULL); struct gcc_cp_template_args targs; @@ -1909,7 +1889,7 @@ compile_cplus_instance::specialize_function_template return result; } -// See description in gcc-cp-fe.def. +/* See description in gcc-cp-fe.def. */ gcc_decl compile_cplus_instance::specialize_class_template (struct type *concrete, @@ -1919,7 +1899,7 @@ compile_cplus_instance::specialize_class_template (struct type *concrete, class_template_defn *defn = find_class_template_defn (concrete); - // A generic should have already been defined. + /* A generic should have already been defined at this point. */ gdb_assert (defn != NULL); struct gcc_cp_template_args targs; @@ -1944,7 +1924,7 @@ compile_cplus_instance::specialize_class_template (struct type *concrete, return result; } -// See description in gcc-cp-fe.def. +/* See description in gcc-cp-fe.def. */ gcc_decl compile_cplus_instance::new_decl (const char *decl_type, @@ -1962,7 +1942,7 @@ compile_cplus_instance::new_decl (const char *decl_type, substitution_name); } -// See description in gcc-cp-fe.def. +/* See description in gcc-cp-fe.def. */ bool compile_cplus_instance::push_namespace (const char *name) @@ -1972,7 +1952,7 @@ compile_cplus_instance::push_namespace (const char *name) return forward ("\"%s\"", name); } -// See description in gcc-cp-fe.def. +/* See description in gcc-cp-fe.def. */ bool compile_cplus_instance::pop_namespace (const char *opt_name) @@ -1982,7 +1962,7 @@ compile_cplus_instance::pop_namespace (const char *opt_name) return forward ("\"%s\"", opt_name); } -// See description in gcc-cp-fe.def. +/* See description in gcc-cp-fe.def. */ gcc_type compile_cplus_instance::error (const char *message) @@ -1992,7 +1972,8 @@ compile_cplus_instance::error (const char *message) return forward ("%s", message); } -// See description in gcc-cp-fe.def. +/* See description in gcc-cp-fe.def. */ + gcc_type compile_cplus_instance::build_reference_type (gcc_type base_type, @@ -2003,7 +1984,7 @@ compile_cplus_instance::build_reference_type (gcc_type base_type, return forward (""); } -// See description in gcc-cp-fe.def. +/* See description in gcc-cp-fe.def. */ gcc_type compile_cplus_instance::build_pointer_type (gcc_type base_type) @@ -2013,7 +1994,7 @@ compile_cplus_instance::build_pointer_type (gcc_type base_type) return forward (""); } -// See description in gcc-cp-fe.def. +/* See description in gcc-cp-fe.def. */ gcc_type compile_cplus_instance::build_vla_array_type (gcc_type element_type, @@ -2024,7 +2005,7 @@ compile_cplus_instance::build_vla_array_type (gcc_type element_type, return forward (""); } -// See description in gcc-cp-fe.def. +/* See description in gcc-cp-fe.def. */ gcc_type compile_cplus_instance::build_vector_type (gcc_type element_type, @@ -2035,7 +2016,7 @@ compile_cplus_instance::build_vector_type (gcc_type element_type, return forward (""); } -// See description in gcc-cp-fe.def. +/* See description in gcc-cp-fe.def. */ gcc_type compile_cplus_instance::build_array_type (gcc_type element_type, @@ -2046,7 +2027,7 @@ compile_cplus_instance::build_array_type (gcc_type element_type, return forward (""); } -// See description in gcc-cp-fe.def. +/* See description in gcc-cp-fe.def. */ gcc_decl compile_cplus_instance::new_field (const char *field_name, gcc_type field_type, @@ -2059,7 +2040,7 @@ compile_cplus_instance::new_field (const char *field_name, gcc_type field_type, return forward ("%s %lld", field_name, field_type); } -// See description in gcc-cp-fe.def. +/* See description in gcc-cp-fe.def. */ gcc_type compile_cplus_instance::build_method_type (gcc_type class_type, @@ -2072,7 +2053,7 @@ compile_cplus_instance::build_method_type (gcc_type class_type, return forward (""); } -// See description in gcc-cp-fe.def. +/* See description in gcc-cp-fe.def. */ gcc_type compile_cplus_instance::start_class_definition @@ -2086,7 +2067,7 @@ compile_cplus_instance::start_class_definition return forward ("%s", name); } -// See description in gcc-cp-fe.def. +/* See description in gcc-cp-fe.def. */ bool compile_cplus_instance::finish_record_or_union (const char *name, @@ -2097,7 +2078,7 @@ compile_cplus_instance::finish_record_or_union (const char *name, return forward ("%s (%ld)", name, size_in_bytes); } -// See description in gcc-cp-fe.def. +/* See description in gcc-cp-fe.def. */ gcc_type compile_cplus_instance::int_type (bool is_unsigned, unsigned long size_in_bytes, @@ -2108,7 +2089,7 @@ compile_cplus_instance::int_type (bool is_unsigned, unsigned long size_in_bytes, return forward ("%d %ld %s", is_unsigned, size_in_bytes, builtin_name); } -// See description in gcc-cp-fe.def. +/* See description in gcc-cp-fe.def. */ gcc_type compile_cplus_instance::start_new_enum_type (const char *name, @@ -2123,7 +2104,7 @@ compile_cplus_instance::start_new_enum_type (const char *name, return forward ("%s", name); } -// See description in gcc-cp-fe.def. +/* See description in gcc-cp-fe.def. */ gcc_decl compile_cplus_instance::build_add_enum_constant (gcc_type enum_type, @@ -2135,7 +2116,7 @@ compile_cplus_instance::build_add_enum_constant (gcc_type enum_type, return forward ("%s = %ld", name, value); } -// See description in gcc-cp-fe.def. +/* See description in gcc-cp-fe.def. */ bool compile_cplus_instance::finish_enum_type (gcc_type enum_type) @@ -2145,7 +2126,7 @@ compile_cplus_instance::finish_enum_type (gcc_type enum_type) return forward (""); } -// See description in gcc-cp-fe.def. +/* See description in gcc-cp-fe.def. */ gcc_type compile_cplus_instance::build_function_type @@ -2158,7 +2139,7 @@ compile_cplus_instance::build_function_type return forward ("%lld %d", return_type, is_varargs); } -// See description in gcc-cp-fe.def. +/* See description in gcc-cp-fe.def. */ gcc_type compile_cplus_instance::char_type () @@ -2168,7 +2149,7 @@ compile_cplus_instance::char_type () return forward (""); } -// See description in gcc-cp-fe.def. +/* See description in gcc-cp-fe.def. */ gcc_type compile_cplus_instance::float_type (unsigned long size_in_bytes, @@ -2179,7 +2160,7 @@ compile_cplus_instance::float_type (unsigned long size_in_bytes, return forward ("%ld %s", size_in_bytes, builtin_name); } -// See description in gcc-cp-fe.def. +/* See description in gcc-cp-fe.def. */ gcc_type compile_cplus_instance::void_type () @@ -2189,7 +2170,7 @@ compile_cplus_instance::void_type () return forward (""); } -// See description in gcc-cp-fe.def. +/* See description in gcc-cp-fe.def. */ gcc_type compile_cplus_instance::bool_type () @@ -2199,7 +2180,7 @@ compile_cplus_instance::bool_type () return forward (""); } -// See description in gcc-cp-fe.def. +/* See description in gcc-cp-fe.def. */ gcc_type compile_cplus_instance::build_qualified_type (gcc_type unqualified_type, @@ -2210,7 +2191,7 @@ compile_cplus_instance::build_qualified_type (gcc_type unqualified_type, return forward (""); } -// See description in gcc-cp-fe.def. +/* See description in gcc-cp-fe.def. */ gcc_type compile_cplus_instance::build_complex_type (gcc_type element_type) @@ -2220,7 +2201,7 @@ compile_cplus_instance::build_complex_type (gcc_type element_type) return forward ("%lld", element_type); } -// See description in gcc-cp-fe.def. +/* See description in gcc-cp-fe.def. */ gcc_expr compile_cplus_instance::literal_expr (gcc_type type, unsigned long value) @@ -2230,7 +2211,7 @@ compile_cplus_instance::literal_expr (gcc_type type, unsigned long value) return forward ("%lld %ld", type, value); } -// See description in gcc-cp-fe.def. +/* See description in gcc-cp-fe.def. */ gcc_type compile_cplus_instance::new_template_typename_parm (const char *id, bool pack_p, @@ -2245,7 +2226,7 @@ compile_cplus_instance::new_template_typename_parm (const char *id, bool pack_p, filename, line_number); } -// See description in gcc-cp-fe.def. +/* See description in gcc-cp-fe.def. */ gcc_decl compile_cplus_instance::new_template_value_parm (gcc_type type, const char *id, @@ -2260,7 +2241,7 @@ compile_cplus_instance::new_template_value_parm (gcc_type type, const char *id, filename, line_number); } -// See description in gcc-cp-fe.def. +/* See description in gcc-cp-fe.def. */ bool compile_cplus_instance::start_new_template_decl (const char *generic) @@ -2270,7 +2251,7 @@ compile_cplus_instance::start_new_template_decl (const char *generic) return forward ("for generic %s\n", generic); } -// See description in gcc-cp-fe.def. +/* See description in gcc-cp-fe.def. */ gcc_type compile_cplus_instance::build_pointer_to_member_type (gcc_type class_type, diff --git a/gdb/compile/compile-cplus.h b/gdb/compile/compile-cplus.h index 1edc05591dc..a633fb8687d 100644 --- a/gdb/compile/compile-cplus.h +++ b/gdb/compile/compile-cplus.h @@ -1,5 +1,5 @@ /* Header file for GDB compile C++ language support. - Copyright (C) 2016 Free Software Foundation, Inc. + Copyright (C) 2016, 2017 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -27,7 +27,7 @@ struct type; struct block; -// enum-flags wrapper +/* enum-flags wrapper */ DEF_ENUM_FLAGS_TYPE (enum gcc_cp_qualifiers, gcc_cp_qualifiers_flags); DEF_ENUM_FLAGS_TYPE (enum gcc_cp_ref_qualifiers, gcc_cp_ref_qualifiers_flags); DEF_ENUM_FLAGS_TYPE (enum gcc_cp_symbol_kind, gcc_cp_symbol_kind_flags); @@ -42,14 +42,14 @@ namespace compile struct scope_component { - // The unqualified name of this scope. + /* The unqualified name of this scope. */ std::string name; - // The block symbol for this type/scope. + /* The block symbol for this type/scope. */ struct block_symbol bsymbol; }; - // Comparison operators for scope_components. + /* Comparison operators for scope_components. */ bool operator== (const scope_component &lhs, const scope_component &rhs); bool operator!= (const scope_component &lhs, const scope_component &rhs); @@ -102,12 +102,13 @@ namespace compile bool m_pushed; }; - // Comparison operators for compile_scopes. + /* Comparison operators for compile_scopes. */ bool operator== (const compile_scope &lhs, const compile_scope &rhs); bool operator!= (const compile_scope &lhs, const compile_scope &rhs); - // A subclass of compile_instance that is specific to the C++ front end. + /* A subclass of compile_instance that is specific to the C++ front + end. */ class compile_cplus_instance : public compile_instance @@ -141,11 +142,13 @@ namespace compile class_template_defn *find_class_template_defn (struct type *type); - // Emit any new function template definitions to the compiler plug-in. + /* Emit any new function template definitions to the compiler + plug-in. */ void emit_function_template_decls (); - // Emit any new class template definitions to the compiler plug-in. + /* Emit any new class template definitions to the compiler + plug-in. */ void emit_class_template_decls (); @@ -171,16 +174,16 @@ namespace compile compile_scope new_scope (const char *type_name, struct type *type); - // Enter the given NEW_SCOPE. + /* Enter the given NEW_SCOPE. */ void enter_scope (compile_scope &scope); - // Leave the current scope. + /* Leave the current scope. */ void leave_scope (); - // !!keiths: YUCK! - // Plug-in forwards + /* !!keiths: YUCK! + Plug-in forwards */ gcc_type bool_type (); @@ -224,7 +227,7 @@ namespace compile bool finish_enum_type (gcc_type enum_type); - // NAME for debugging + /* NAME for debugging */ bool finish_record_or_union (const char *name, unsigned long size_in_bytes); gcc_type float_type (unsigned long size_in_bytes, const char *builtin_name); @@ -234,7 +237,7 @@ namespace compile gcc_expr literal_expr (gcc_type type, unsigned long value); - // DECL_DESC for debugging only + /* DECL_DESC for debugging only */ gcc_decl new_decl (const char *decl_desc, const char *name, enum gcc_cp_symbol_kind sym_kind, gcc_type sym_type, const char *substitution_name, @@ -255,7 +258,7 @@ namespace compile const char *filename, unsigned int line_number); - // NAME is for debugging only + /* NAME is for debugging only */ bool pop_namespace (const char *name); bool push_namespace (const char *name); @@ -269,7 +272,7 @@ namespace compile const char *filename, unsigned int line_number); - // NAME only for debugging + /* NAME only for debugging */ gcc_type start_class_definition (const char *name, gcc_decl typedecl, const struct gcc_vbase_array *base_classes, const char *filename, @@ -281,7 +284,7 @@ namespace compile const char *filename, unsigned int line_number); - // GENERIC only for debugging + /* GENERIC only for debugging */ bool start_new_template_decl (const char *generic); gcc_type void_type (); @@ -289,22 +292,22 @@ namespace compile private: - // Enumerate the template arguments of template DEFN into DEST. + /* Enumerate the template arguments of template DEFN into DEST. */ void enumerate_template_arguments (struct gcc_cp_template_args *dest, const template_defn *defn, const struct template_argument_info *arg_info); - // The C++ compile plug-in context. + /* The C++ compile plug-in context. */ struct gcc_cp_context *m_context; - // A cache of function template definitions. + /* A cache of function template definitions. */ std::unique_ptr m_function_template_defns; - // A cache of class template definitions. + /* A cache of class template definitions. */ std::unique_ptr m_class_template_defns; - // A list of scopes we are processing. + /* A list of scopes we are processing. */ std::vector m_scopes; }; @@ -314,18 +317,20 @@ namespace compile char *decl_name (const char *natural); - // Add the qualifiers given by QUALS to BASE. + /* Add the qualifiers given by QUALS to BASE. */ gcc_type convert_qualified_base (compile_cplus_instance *instance, gcc_type base, gcc_cp_qualifiers_flags quals); - // Convert TARGET into a pointer type in the given compiler INSTANCE. + /* Convert TARGET into a pointer type in the given compiler + INSTANCE. */ gcc_type convert_pointer_base (compile_cplus_instance *instance, gcc_type target); - // Convert BASE into a reference type in the given compile INSTANCE. + /* Convert BASE into a reference type in the given compile + INSTANCE. */ gcc_type convert_reference_base (compile_cplus_instance *instance, gcc_type base); @@ -374,4 +379,4 @@ extern gcc_cp_symbol_address_function gcc_cplus_symbol_address; extern gcc_cp_enter_leave_user_expr_scope_function gcc_cplus_enter_scope; extern gcc_cp_enter_leave_user_expr_scope_function gcc_cplus_leave_scope; -#endif // GDB_COMPILE_CPLUS_H +#endif /* GDB_COMPILE_CPLUS_H */ diff --git a/gdb/compile/compile-internal.h b/gdb/compile/compile-internal.h index 018b0bafbca..79775decf35 100644 --- a/gdb/compile/compile-internal.h +++ b/gdb/compile/compile-internal.h @@ -1,5 +1,5 @@ /* Header file for GDB compile command and supporting functions. - Copyright (C) 2014-2016 Free Software Foundation, Inc. + Copyright (C) 2014-2017 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -50,7 +50,7 @@ public: { } - // Returns the GCC options to be passed during compilation. + /* Returns the GCC options to be passed during compilation. */ const std::string &gcc_target_options () const { @@ -64,7 +64,7 @@ public: void insert_type (struct type *type, gcc_type gcc_type); - // Associate SYMBOL with some error text. + /* Associate SYMBOL with some error text. */ void insert_symbol_error (const struct symbol *sym, std::string text); @@ -76,20 +76,20 @@ public: /* These currently just forward to the underlying ops vtable. */ - // Set the plug-in print callback. + /* Set the plug-in print callback. */ void set_print_callback (void (*print_function) (void *, const char *), void *datum); - // Return the plug-in's front-end version. + /* Return the plug-in's front-end version. */ unsigned int version () const; - // Set the plug-in's verbosity level. + /* Set the plug-in's verbosity level. */ void set_verbose (int level); - // Set the plug-in driver program. + /* Set the plug-in driver program. */ void set_driver_filename (const char *filename); @@ -98,48 +98,48 @@ public: void set_triplet_regexp (const char *regexp); - // Set compilation arguments. + /* Set compilation arguments. */ char *set_arguments (int argc, char **argv); - // !!keiths: YUCK! + /* !!keiths: YUCK! */ char *set_arguments (const char *regexp, int argc, char **argv); - // Set the filename of the program to compile. + /* Set the filename of the program to compile. */ void set_source_file (const char *filename); - // Compile the previously specified source file to FILENAME. + /* Compile the previously specified source file to FILENAME. */ bool compile (const char *filename); - // Same as above, but for earlier protocol versions. + /* Same as above, but for earlier protocol versions. */ bool compile (const char *filename, int verbose_level); - // Set the scope type for this compile. + /* Set the scope type for this compile. */ void set_scope (enum compile_i_scope_types scope) { m_scope = scope; } - // Return the scope type. + /* Return the scope type. */ enum compile_i_scope_types scope () const { return m_scope; } - // Set the block to be used for symbol searches. + /* Set the block to be used for symbol searches. */ void set_block (const struct block *block) { m_block = block; } - // Return the search block. + /* Return the search block. */ const struct block *block () const { @@ -157,27 +157,27 @@ protected: typedef std::unordered_map symbol_err_map_t; - // The GCC front end. + /* The GCC front end. */ struct gcc_base_context *m_gcc_fe; - // The "scope" of this compilation. + /* The "scope" of this compilation. */ enum compile_i_scope_types m_scope; - // The block in which an expression is being parsed. + /* The block in which an expression is being parsed. */ const struct block *m_block; /* Specify "-std=gnu11", "-std=gnu++11" or similar. These options are put after CU's DW_AT_producer compilation options to override them. */ std::string m_gcc_target_options; - // Map from gdb types to gcc types. + /* Map from gdb types to gcc types. */ type_map_t m_type_map; - // Map from gdb symbols to gcc error messages to emit. + /* Map from gdb symbols to gcc error messages to emit. */ symbol_err_map_t m_symbol_err_map; }; -// Define header and footers for different scopes. +/* Define the headers and footers for different scopes. */ /* A simple scope just declares a function named "_gdb_expr", takes no arguments and returns no value. */ @@ -190,7 +190,7 @@ protected: #define COMPILE_I_EXPR_VAL "__gdb_expr_val" #define COMPILE_I_EXPR_PTR_TYPE "__gdb_expr_ptr_type" -// A "type" to indicate a NULL type. +/* A "type" to indicate a NULL type. */ const gcc_type GCC_TYPE_NONE = (gcc_type) -1; diff --git a/gdb/compile/compile.c b/gdb/compile/compile.c index bc3fc4b5eb2..154046f9e41 100644 --- a/gdb/compile/compile.c +++ b/gdb/compile/compile.c @@ -1,6 +1,6 @@ /* General Compile and inject code - Copyright (C) 2014-2016 Free Software Foundation, Inc. + Copyright (C) 2014-2017 Free Software Foundation, Inc. This file is part of GDB. @@ -578,7 +578,7 @@ compile_to_object (struct command_line *cmd, const char *cmd_string, get_args (compiler, gdbarch, &argc, &argv); make_cleanup_freeargv (argv); - // !!keiths: This should be hidden at this level! + /* !!keiths: This should be hidden at this level! */ if (compiler->version ()>= GCC_FE_VERSION_1) error_message = compiler->set_arguments (argc, argv); else @@ -708,7 +708,7 @@ compile_register_name_demangle (struct gdbarch *gdbarch, error (_("Cannot find gdbarch register \"%s\"."), regname); } -// See description in compile-internal.h. +/* See description in compile-internal.h. */ void compile_instance::insert_type (struct type *type, gcc_type gcc_type) @@ -727,7 +727,7 @@ compile_instance::insert_type (struct type *type, gcc_type gcc_type) m_type_map.insert (std::make_pair (type, gcc_type)); } -// See description in compile-internal.h. +/* See description in compile-internal.h. */ void compile_instance::insert_symbol_error (const struct symbol *sym, @@ -739,7 +739,7 @@ compile_instance::insert_symbol_error (const struct symbol *sym, m_symbol_err_map.insert (std::make_pair (sym, text)); } -// See description in compile-internal.h. +/* See description in compile-internal.h. */ void compile_instance::error_symbol_once (const struct symbol *sym) @@ -753,11 +753,11 @@ compile_instance::error_symbol_once (const struct symbol *sym) ::error (_("%s"), message.c_str ()); } -// Forwards to the plug-in. +/* Forwards to the plug-in. */ #define FORWARD(OP,...) (m_gcc_fe->ops->OP (m_gcc_fe, ##__VA_ARGS__)) -// Set the plug-in print callback. +/* Set the plug-in print callback. */ void compile_instance::set_print_callback @@ -766,7 +766,7 @@ compile_instance::set_print_callback FORWARD (set_print_callback, print_function, datum); } -// Return the plug-in's front-end version. +/* Return the plug-in's front-end version. */ unsigned int compile_instance::version () const @@ -774,7 +774,7 @@ compile_instance::version () const return m_gcc_fe->ops->version; } -// Set the plug-in's verbosity level. +/* Set the plug-in's verbosity level. */ void compile_instance::set_verbose (int level) @@ -782,26 +782,26 @@ compile_instance::set_verbose (int level) FORWARD (set_verbose, level); } -// Set the plug-in driver program. +/* Set the plug-in driver program. */ void compile_instance::set_driver_filename (const char *filename) { - // !!keiths: Possible leak??? + /* !!keiths: Possible leak??? */ FORWARD (set_driver_filename, filename); } -// Set the regular expression used to match the configury triplet -// prefix to the compiler. +/* Set the regular expression used to match the configury triplet + prefix to the compiler. */ void compile_instance::set_triplet_regexp (const char *regexp) { - // !!keiths: Leak? + /* !!keiths: Leak? */ FORWARD (set_triplet_regexp, regexp); } -// Set compilation arguments. +/* Set compilation arguments. */ char * compile_instance::set_arguments (int argc, char **argv) @@ -809,7 +809,7 @@ compile_instance::set_arguments (int argc, char **argv) return FORWARD (set_arguments, argc, argv); } -// !!keiths: YUCK! +/* !!keiths: YUCK! */ char * compile_instance::set_arguments (const char *regexp, int argc, char **argv) @@ -817,7 +817,7 @@ compile_instance::set_arguments (const char *regexp, int argc, char **argv) return FORWARD (set_arguments_v0, regexp, argc, argv); } -// Set the filename of the program to compile. +/* Set the filename of the program to compile. */ void compile_instance::set_source_file (const char *filename) @@ -825,7 +825,7 @@ compile_instance::set_source_file (const char *filename) FORWARD (set_source_file, filename); } -// Compile the previously specified source file to FILENAME. +/* Compile the previously specified source file to FILENAME. */ bool compile_instance::compile (const char *filename) @@ -833,7 +833,7 @@ compile_instance::compile (const char *filename) return FORWARD (compile, filename); } -// Like above, but for an earlier compile protocol. +/* As above, but for an earlier compile protocol. */ bool compile_instance::compile (const char *filename, int verbose_level) -- 2.47.3