Skip to content

Commit 44a70f5

Browse files
Merge pull request #1637 from augusto2112/class-constrained-protocol-eval-rebranch
Disable loading scalars as addresses when materializing an entity variable [master-rebranch]
2 parents 59ef85e + 5806aeb commit 44a70f5

File tree

1 file changed

+5
-15
lines changed

1 file changed

+5
-15
lines changed

lldb/source/Expression/Materializer.cpp

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -413,20 +413,14 @@ class EntityVariable : public Materializer::Entity {
413413
public:
414414
EntityVariable(lldb::VariableSP &variable_sp)
415415
: Entity(), m_variable_sp(variable_sp), m_is_reference(false),
416-
m_is_generic(false), m_temporary_allocation(LLDB_INVALID_ADDRESS),
416+
m_temporary_allocation(LLDB_INVALID_ADDRESS),
417417
m_temporary_allocation_size(0) {
418418
// Hard-coding to maximum size of a pointer since all variables are
419419
// materialized by reference
420420
m_size = 8;
421421
m_alignment = 8;
422422
m_is_reference =
423423
m_variable_sp->GetType()->GetForwardCompilerType().IsReferenceType();
424-
#ifdef LLDB_ENABLE_SWIFT
425-
m_is_generic = SwiftASTContext::IsGenericType(
426-
m_variable_sp->GetType()->GetForwardCompilerType());
427-
#else // !LLDB_ENABLE_SWIFT
428-
m_is_generic = false;
429-
#endif // LLDB_ENABLE_SWIFT
430424
}
431425

432426
void Materialize(lldb::StackFrameSP &frame_sp, IRMemoryMap &map,
@@ -495,13 +489,10 @@ class EntityVariable : public Materializer::Entity {
495489
}
496490
} else {
497491
AddressType address_type = eAddressTypeInvalid;
498-
const bool is_dynamic_class_type =
499-
m_is_generic &&
500-
(valobj_type.GetTypeClass() == lldb::eTypeClassClass);
501-
const bool scalar_is_load_address = m_is_generic; // this is the only
502-
// time we're dealing
503-
// with dynamic values
504-
492+
const bool scalar_is_load_address = false;
493+
lldb::addr_t addr_of_valobj =
494+
valobj_sp->GetAddressOf(scalar_is_load_address, &address_type);
495+
505496
// if the dynamic type is a class, bypass the GetAddressOf() optimization
506497
// as it doesn't do the right thing
507498
lldb::addr_t addr_of_valobj =
@@ -808,7 +799,6 @@ class EntityVariable : public Materializer::Entity {
808799
private:
809800
lldb::VariableSP m_variable_sp;
810801
bool m_is_reference;
811-
bool m_is_generic;
812802
lldb::addr_t m_temporary_allocation;
813803
size_t m_temporary_allocation_size;
814804
lldb::DataBufferSP m_original_data;

0 commit comments

Comments
 (0)