/* Definitions for expressions in GDB
- Copyright (C) 2020 Free Software Foundation, Inc.
+ Copyright (C) 2020-2022 Free Software Foundation, Inc.
This file is part of GDB.
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);
return exp_objfile == objfile;
}
-static inline bool
+static inline bool
check_objfile (struct type *type, struct objfile *objfile)
{
struct objfile *ty_objfile = type->objfile_owner ();
return false;
}
-static inline bool
+static inline bool
check_objfile (struct symbol *sym, struct objfile *objfile)
{
return check_objfile (symbol_objfile (sym), objfile);
}
-static inline bool
+static inline bool
check_objfile (const struct block *block, struct objfile *objfile)
{
return check_objfile (block_objfile (block), objfile);
}
static inline bool
-check_objfile (minimal_symbol *minsym, struct objfile *objfile)
+check_objfile (const block_symbol &sym, struct objfile *objfile)
{
- /* This may seem strange but minsyms are only used with an objfile
- as well. */
- return false;
+ return (check_objfile (sym.symbol, objfile)
+ || check_objfile (sym.block, objfile));
+}
+
+static inline bool
+check_objfile (bound_minimal_symbol minsym, struct objfile *objfile)
+{
+ return check_objfile (minsym.objfile, objfile);
}
static inline bool
return false;
}
-static inline bool
+static inline bool
check_objfile (const operation_up &op, struct objfile *objfile)
{
return op->uses_objfile (objfile);
}
template<typename T>
-static inline bool
+static inline bool
check_objfile (const std::vector<T> &collection, struct objfile *objfile)
{
for (const auto &item : collection)
}
template<typename S, typename T>
-static inline bool
+static inline bool
check_objfile (const std::pair<S, T> &item, struct objfile *objfile)
{
return (check_objfile (item.first, objfile)
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);
+ const block_symbol &sym);
+extern void dump_for_expression (struct ui_file *stream, int depth,
+ 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,
enum c_string_type_values flags);
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);
}
static inline bool
-check_constant (struct minimal_symbol *msym)
+check_constant (bound_minimal_symbol msym)
{
return false;
}
return true;
}
-static inline bool
-check_constant (struct objfile *objfile)
-{
- return true;
-}
-
static inline bool
check_constant (ULONGEST cst)
{
|| sc == LOC_LABEL);
}
+static inline bool
+check_constant (const block_symbol &sym)
+{
+ /* We know the block is constant, so we only need to check the
+ symbol. */
+ return check_constant (sym.symbol);
+}
+
template<typename T>
static inline bool
check_constant (const std::vector<T> &collection)
/* Compute the value of a variable. */
class var_value_operation
- : public maybe_constant_operation<symbol *, const block *>
+ : public maybe_constant_operation<block_symbol>
{
public:
/* Return the symbol referenced by this object. */
symbol *get_symbol () const
{
- return std::get<0> (m_storage);
+ return std::get<0> (m_storage).symbol;
}
protected:
};
class var_msym_value_operation
- : public maybe_constant_operation<minimal_symbol *, struct objfile *>
+ : public maybe_constant_operation<bound_minimal_symbol>
{
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)
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);
}