gdb: Convert la_store_sym_names_in_linkage_form_p to a method
[deliverable/binutils-gdb.git] / gdb / c-lang.c
index d6bbc025bc7bc93c595923f29bc77f515df46200..c8fe630c247a9c674a47ce6653ccc6d9a4dbf941 100644 (file)
@@ -871,33 +871,17 @@ const struct exp_descriptor exp_descriptor_c =
   evaluate_subexp_c
 };
 
-static const char *c_extensions[] =
-{
-  ".c", NULL
-};
-
 /* Constant data that describes the C language.  */
 
 extern const struct language_data c_language_data =
 {
-  "c",                         /* Language name */
-  "C",
-  language_c,
   range_check_off,
   case_sensitive_on,
   array_row_major,
   macro_expansion_c,
-  c_extensions,
   &exp_descriptor_c,
-  c_print_typedef,             /* Print a typedef using appropriate syntax */
-  NULL,                                /* name_of_this */
-  true,                                /* la_store_sym_names_in_linkage_form_p */
   c_op_print_tab,              /* expression operators for printing */
-  1,                           /* c-style arrays */
-  0,                           /* String lower bound */
   &c_varobj_ops,
-  c_is_string_type_p,
-  "{...}"                      /* la_struct_too_deep_ellipsis */
 };
 
 /* Class representing the C language.  */
@@ -909,6 +893,24 @@ public:
     : language_defn (language_c, c_language_data)
   { /* Nothing.  */ }
 
+  /* See language.h.  */
+
+  const char *name () const override
+  { return "c"; }
+
+  /* See language.h.  */
+
+  const char *natural_name () const override
+  { return "C"; }
+
+  /* See language.h.  */
+
+  const std::vector<const char *> &filename_extensions () const override
+  {
+    static const std::vector<const char *> extensions = { ".c" };
+    return extensions;
+  }
+
   /* See language.h.  */
   void language_arch_info (struct gdbarch *gdbarch,
                           struct language_arch_info *lai) const override
@@ -940,6 +942,11 @@ public:
   {
     c_print_type (type, varstring, stream, show, level, flags);
   }
+
+  /* See language.h.  */
+
+  bool store_sym_names_in_linkage_form_p () const override
+  { return true; }
 };
 
 /* Single instance of the C language class.  */
@@ -974,33 +981,17 @@ enum cplus_primitive_types {
   nr_cplus_primitive_types
 };
 
-static const char *cplus_extensions[] =
-{
-  ".C", ".cc", ".cp", ".cpp", ".cxx", ".c++", NULL
-};
-
 /* Constant data that describes the C++ language.  */
 
 extern const struct language_data cplus_language_data =
 {
-  "c++",                       /* Language name */
-  "C++",
-  language_cplus,
   range_check_off,
   case_sensitive_on,
   array_row_major,
   macro_expansion_c,
-  cplus_extensions,
   &exp_descriptor_c,
-  c_print_typedef,             /* Print a typedef using appropriate syntax */
-  "this",                       /* name_of_this */
-  false,                       /* la_store_sym_names_in_linkage_form_p */
   c_op_print_tab,              /* expression operators for printing */
-  1,                           /* c-style arrays */
-  0,                           /* String lower bound */
   &cplus_varobj_ops,
-  c_is_string_type_p,
-  "{...}"                      /* la_struct_too_deep_ellipsis */
 };
 
 /* A class for the C++ language.  */
@@ -1014,6 +1005,25 @@ public:
 
   /* See language.h.  */
 
+  const char *name () const override
+  { return "c++"; }
+
+  /* See language.h.  */
+
+  const char *natural_name () const override
+  { return "C++"; }
+
+  /* See language.h.  */
+
+  const std::vector<const char *> &filename_extensions () const override
+  {
+    static const std::vector<const char *> extensions
+      = { ".C", ".cc", ".cp", ".cpp", ".cxx", ".c++" };
+    return extensions;
+  }
+
+  /* See language.h.  */
+
   struct language_pass_by_ref_info pass_by_reference_info
        (struct type *type) const override
   {
@@ -1159,6 +1169,11 @@ public:
     return cp_lookup_symbol_nonlocal (this, name, block, domain);
   }
 
+  /* See language.h.  */
+
+  const char *name_of_this () const override
+  { return "this"; }
+
 protected:
 
   /* See language.h.  */
@@ -1174,33 +1189,17 @@ protected:
 
 static cplus_language cplus_language_defn;
 
-static const char *asm_extensions[] =
-{
-  ".s", ".sx", ".S", NULL
-};
-
 /* Constant data that describes the ASM language.  */
 
 extern const struct language_data asm_language_data =
 {
-  "asm",                       /* Language name */
-  "assembly",
-  language_asm,
   range_check_off,
   case_sensitive_on,
   array_row_major,
   macro_expansion_c,
-  asm_extensions,
   &exp_descriptor_c,
-  c_print_typedef,             /* Print a typedef using appropriate syntax */
-  NULL,                                /* name_of_this */
-  true,                                /* la_store_sym_names_in_linkage_form_p */
   c_op_print_tab,              /* expression operators for printing */
-  1,                           /* c-style arrays */
-  0,                           /* String lower bound */
   &default_varobj_ops,
-  c_is_string_type_p,
-  "{...}"                      /* la_struct_too_deep_ellipsis */
 };
 
 /* A class for the ASM language.  */
@@ -1212,6 +1211,25 @@ public:
     : language_defn (language_asm, asm_language_data)
   { /* Nothing.  */ }
 
+  /* See language.h.  */
+
+  const char *name () const override
+  { return "asm"; }
+
+  /* See language.h.  */
+
+  const char *natural_name () const override
+  { return "Assembly"; }
+
+  /* See language.h.  */
+
+  const std::vector<const char *> &filename_extensions () const override
+  {
+    static const std::vector<const char *> extensions
+      = { ".s", ".sx", ".S" };
+    return extensions;
+  }
+
   /* See language.h.
 
      FIXME: Should this have its own arch info method?  */
@@ -1229,6 +1247,11 @@ public:
   {
     c_print_type (type, varstring, stream, show, level, flags);
   }
+
+  /* See language.h.  */
+
+  bool store_sym_names_in_linkage_form_p () const override
+  { return true; }
 };
 
 /* The single instance of the ASM language class.  */
@@ -1241,24 +1264,13 @@ static asm_language asm_language_defn;
 
 extern const struct language_data minimal_language_data =
 {
-  "minimal",                   /* Language name */
-  "Minimal",
-  language_minimal,
   range_check_off,
   case_sensitive_on,
   array_row_major,
   macro_expansion_c,
-  NULL,
   &exp_descriptor_c,
-  c_print_typedef,             /* Print a typedef using appropriate syntax */
-  NULL,                                /* name_of_this */
-  true,                                /* la_store_sym_names_in_linkage_form_p */
   c_op_print_tab,              /* expression operators for printing */
-  1,                           /* c-style arrays */
-  0,                           /* String lower bound */
   &default_varobj_ops,
-  c_is_string_type_p,
-  "{...}"                      /* la_struct_too_deep_ellipsis */
 };
 
 /* A class for the minimal language.  */
@@ -1270,6 +1282,16 @@ public:
     : language_defn (language_minimal, minimal_language_data)
   { /* Nothing.  */ }
 
+  /* See language.h.  */
+
+  const char *name () const override
+  { return "minimal"; }
+
+  /* See language.h.  */
+
+  const char *natural_name () const override
+  { return "Minimal"; }
+
   /* See language.h.  */
   void language_arch_info (struct gdbarch *gdbarch,
                           struct language_arch_info *lai) const override
@@ -1285,6 +1307,11 @@ public:
   {
     c_print_type (type, varstring, stream, show, level, flags);
   }
+
+  /* See language.h.  */
+
+  bool store_sym_names_in_linkage_form_p () const override
+  { return true; }
 };
 
 /* The single instance of the minimal language class.  */
This page took 0.029195 seconds and 4 git commands to generate.