summaryrefslogtreecommitdiff
path: root/gdb/expop.h
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2021-03-08 07:27:57 -0700
committerTom Tromey <tom@tromey.com>2021-03-08 07:28:44 -0700
commit9c79936b3df018166d53869f7f2bb2909f129e51 (patch)
treea878d993489408177c7d6b6a724276b30aed2b1d /gdb/expop.h
parent40d07d07d051308626f6079fa6d1598fafb445c7 (diff)
downloadbinutils-gdb-9c79936b3df018166d53869f7f2bb2909f129e51.tar.gz
Use bound_minimal_symbol in var_msym_value_operation
This changes var_msym_value_operation to use a bound_minimal_symbol rather than separate minsym and objfile parameters. The main benefit of this is removing the possibly-confusing check_objfile overload for a plain minimal symbol. gdb/ChangeLog 2021-03-08 Tom Tromey <tom@tromey.com> * parse.c (parser_state::push_symbol, parser_state::push_dollar): Update. * p-exp.y (variable): Update. * go-exp.y (variable): Update. * expprint.c (dump_for_expression): Use bound_minimal_symbol. Remove overload for objfile. * expop.h (eval_op_var_msym_value): Use bound_minimal_symbol parameter. (check_objfile): Likewise. (dump_for_expression): Likewise. Remove overload for objfile. (class var_msym_value_operation): Use bound_minimal_symbol. * eval.c (eval_op_var_msym_value): Use bound_minimal_symbol parameter. (var_msym_value_operation::evaluate_for_address) (var_msym_value_operation::evaluate_for_sizeof) (var_msym_value_operation::evaluate_for_cast): Update. * d-exp.y (PrimaryExpression): Update. * c-exp.y (variable): Update. * ax-gdb.c (var_msym_value_operation::do_generate_ax): Update. * ada-lang.c (ada_var_msym_value_operation::evaluate_for_cast): Update. * ada-exp.y (write_var_or_type): Update.
Diffstat (limited to 'gdb/expop.h')
-rw-r--r--gdb/expop.h28
1 files changed, 8 insertions, 20 deletions
diff --git a/gdb/expop.h b/gdb/expop.h
index c12a55e8db3..cc8d9ca6741 100644
--- a/gdb/expop.h
+++ b/gdb/expop.h
@@ -53,8 +53,7 @@ extern struct value *eval_op_var_msym_value (struct type *expect_type,
struct expression *exp,
enum noside noside,
bool outermost_p,
- minimal_symbol *msymbol,
- struct objfile *objfile);
+ bound_minimal_symbol msymbol);
extern struct value *eval_op_var_entry_value (struct type *expect_type,
struct expression *exp,
enum noside noside, symbol *sym);
@@ -244,11 +243,9 @@ check_objfile (const struct block *block, struct objfile *objfile)
}
static inline bool
-check_objfile (minimal_symbol *minsym, struct objfile *objfile)
+check_objfile (bound_minimal_symbol minsym, struct objfile *objfile)
{
- /* This may seem strange but minsyms are only used with an objfile
- as well. */
- return false;
+ return check_objfile (minsym.objfile, objfile);
}
static inline bool
@@ -331,7 +328,7 @@ extern void dump_for_expression (struct ui_file *stream, int depth,
extern void dump_for_expression (struct ui_file *stream, int depth,
symbol *sym);
extern void dump_for_expression (struct ui_file *stream, int depth,
- minimal_symbol *msym);
+ bound_minimal_symbol msym);
extern void dump_for_expression (struct ui_file *stream, int depth,
const block *bl);
extern void dump_for_expression (struct ui_file *stream, int depth,
@@ -341,8 +338,6 @@ extern void dump_for_expression (struct ui_file *stream, int depth,
extern void dump_for_expression (struct ui_file *stream, int depth,
enum range_flag flags);
extern void dump_for_expression (struct ui_file *stream, int depth,
- objfile *objf);
-extern void dump_for_expression (struct ui_file *stream, int depth,
const std::unique_ptr<ada_component> &comp);
template<typename T>
@@ -446,7 +441,7 @@ check_constant (const operation_up &item)
}
static inline bool
-check_constant (struct minimal_symbol *msym)
+check_constant (bound_minimal_symbol msym)
{
return false;
}
@@ -470,12 +465,6 @@ check_constant (const std::string &str)
}
static inline bool
-check_constant (struct objfile *objfile)
-{
- return true;
-}
-
-static inline bool
check_constant (ULONGEST cst)
{
return true;
@@ -700,7 +689,7 @@ protected:
};
class var_msym_value_operation
- : public maybe_constant_operation<minimal_symbol *, struct objfile *>
+ : public maybe_constant_operation<bound_minimal_symbol>
{
public:
@@ -711,8 +700,7 @@ public:
enum noside noside) override
{
return eval_op_var_msym_value (expect_type, exp, noside, m_outermost,
- std::get<0> (m_storage),
- std::get<1> (m_storage));
+ std::get<0> (m_storage));
}
value *evaluate_for_sizeof (struct expression *exp, enum noside noside)
@@ -730,7 +718,7 @@ public:
enum noside noside,
const std::vector<operation_up> &args) override
{
- const char *name = std::get<0> (m_storage)->print_name ();
+ const char *name = std::get<0> (m_storage).minsym->print_name ();
return operation::evaluate_funcall (expect_type, exp, noside, name, args);
}