@@ -200,6 +200,11 @@ std::optional<Expr> ExprGenerator::gen_variable_expr_impl(
200200
201201 std::vector<std::reference_wrapper<const VariableExpr>> vars;
202202 for (const auto & [k, v] : symtab_.vars ()) {
203+ // Skip long double variables if long double isn't enabled.
204+ if (!cfg_.long_double_enabled && k == Type (ScalarType::LongDouble)) {
205+ continue ;
206+ }
207+
203208 if (type_constraints.allows_type (k)) {
204209 for (const auto & var : v) {
205210 if (var.expr .name () == " this" && constraints.must_be_lvalue ()) {
@@ -729,12 +734,21 @@ std::optional<Expr> ExprGenerator::gen_member_of_ptr_expr_impl(
729734
730735 Field field = rng_->pick_field (fields);
731736 TypeConstraints new_type_constraints (field.containing_type ());
732- // If the field is a reference or a virtually inherited field, assume a read
733- // from memory.
734- MemoryConstraints new_memory_constraints =
735- field.is_reference_or_virtual ()
736- ? MemoryConstraints (true , 1 )
737- : memory_constraints.from_member_of (constraints.must_be_lvalue (), 1 );
737+
738+ // `&(ptr)->field` is equivalent to `ptr + offset(field)` where offset can
739+ // be determined statically if the `field` isn't a reference or a virtually
740+ // inherited field (in these cases a read from memory is expected). However,
741+ // lldb-eval doesn't support address-of elision for member-of expressions,
742+ // so assume a read from memory in all cases.
743+ MemoryConstraints new_memory_constraints (true , 1 );
744+
745+ // TODO: Uncomment the following code once lldb-eval supports address-of
746+ // elision for member-of expressions.
747+ // MemoryConstraints new_memory_constraints =
748+ // field.is_reference_or_virtual() ? MemoryConstraints(true, 1)
749+ // : memory_constraints.from_member_of(
750+ // constraints.must_be_lvalue(), 1);
751+
738752 ExprConstraints new_constraints =
739753 ExprConstraints (new_type_constraints.make_pointer_constraints (),
740754 std::move (new_memory_constraints));
@@ -1267,6 +1281,11 @@ std::optional<Type> ExprGenerator::gen_tagged_type(
12671281std::optional<Type> ExprGenerator::gen_scalar_type (
12681282 const TypeConstraints& constraints) {
12691283 ScalarMask mask = constraints.allowed_scalar_types ();
1284+
1285+ if (!cfg_.long_double_enabled ) {
1286+ mask[ScalarType::LongDouble] = false ;
1287+ }
1288+
12701289 if (mask.none ()) {
12711290 return {};
12721291 }
0 commit comments