Implement timestamp'ed output on "make check"
[deliverable/binutils-gdb.git] / gdb / language.h
index 029de4a7abb31a5bcae07ebb22b8640862bc643a..957706566996a35ec2023f2df40bb8fb4c71f5e5 100644 (file)
@@ -36,7 +36,7 @@ struct value_print_options;
 struct type_print_options;
 struct lang_varobj_ops;
 struct parser_state;
-struct compile_instance;
+class compile_instance;
 struct completion_match_for_lcd;
 
 #define MAX_FORTRAN_DIMS  7    /* Maximum number of F77 array dims.  */
@@ -172,10 +172,6 @@ struct language_defn
 
     int (*la_parser) (struct parser_state *);
 
-    /* Parser error function.  */
-
-    void (*la_error) (const char *);
-
     /* Given an expression *EXPP created by prefixifying the result of
        la_parser, perform any remaining processing necessary to complete
        its translation.  *EXPP may change; la_post_parser is responsible 
@@ -370,8 +366,10 @@ struct language_defn
        characters, excluding any eventual terminating null character.
        Otherwise *LENGTH will include all characters - including any nulls.
        CHARSET will hold the encoding used in the string.  */
-    void (*la_get_string) (struct value *value, gdb_byte **buffer, int *length,
-                          struct type **chartype, const char **charset);
+    void (*la_get_string) (struct value *value,
+                          gdb::unique_xmalloc_ptr<gdb_byte> *buffer,
+                          int *length, struct type **chartype,
+                          const char **charset);
 
     /* Return an expression that can be used for a location
        watchpoint.  TYPE is a pointer type that points to the memory
@@ -426,7 +424,7 @@ struct language_defn
        instance is owned by its caller and must be deallocated by
        calling its 'destroy' method.  */
 
-    struct compile_instance *(*la_get_compile_instance) (void);
+    compile_instance *(*la_get_compile_instance) (void);
 
     /* This method must be defined if 'la_get_gcc_context' is defined.
        If 'la_get_gcc_context' is not defined, then this method is
@@ -442,7 +440,7 @@ struct language_defn
        parsed.
        EXPR_PC is the PC at which the expression is being parsed.  */
 
-    std::string (*la_compute_program) (struct compile_instance *inst,
+    std::string (*la_compute_program) (compile_instance *inst,
                                       const char *input,
                                       struct gdbarch *gdbarch,
                                       const struct block *expr_block,
@@ -631,8 +629,10 @@ int default_pass_by_reference (struct type *type);
 void default_print_typedef (struct type *type, struct symbol *new_symbol,
                            struct ui_file *stream);
 
-void default_get_string (struct value *value, gdb_byte **buffer, int *length,
-                        struct type **char_type, const char **charset);
+void default_get_string (struct value *value,
+                        gdb::unique_xmalloc_ptr<gdb_byte> *buffer,
+                        int *length, struct type **char_type,
+                        const char **charset);
 
 /* Default name hashing function.  */
 
@@ -642,8 +642,10 @@ void default_get_string (struct value *value, gdb_byte **buffer, int *length,
    comparison operators hash to the same value.  */
 extern unsigned int default_search_name_hash (const char *search_name);
 
-void c_get_string (struct value *value, gdb_byte **buffer, int *length,
-                  struct type **char_type, const char **charset);
+void c_get_string (struct value *value,
+                  gdb::unique_xmalloc_ptr<gdb_byte> *buffer,
+                  int *length, struct type **char_type,
+                  const char **charset);
 
 /* The default implementation of la_symbol_name_matcher.  Matches with
    strncmp_iw.  */
@@ -705,4 +707,39 @@ private:
   enum language m_lang;
 };
 
+/* If language_mode is language_mode_auto,
+   then switch current language to the language of SYM
+   and restore current language upon destruction.
+
+   Else do nothing.  */
+
+class scoped_switch_to_sym_language_if_auto
+{
+public:
+
+  explicit scoped_switch_to_sym_language_if_auto (const struct symbol *sym)
+  {
+    if (language_mode == language_mode_auto)
+      {
+       m_lang = current_language->la_language;
+       m_switched = true;
+       set_language (SYMBOL_LANGUAGE (sym));
+      }
+    else
+      m_switched = false;
+  }
+
+  ~scoped_switch_to_sym_language_if_auto ()
+  {
+    if (m_switched)
+      set_language (m_lang);
+  }
+
+  DISABLE_COPY_AND_ASSIGN (scoped_switch_to_sym_language_if_auto);
+
+private:
+  bool m_switched;
+  enum language m_lang;
+};
+
 #endif /* defined (LANGUAGE_H) */
This page took 0.026164 seconds and 4 git commands to generate.