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. */
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
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
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
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,
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. */
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. */
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) */