Skip to content

Commit e472464

Browse files
committed
Retire DynamicValueTypeInfoNeedsUpdate() (NFC)
This function was introduced to detect a stale Swift scratch context. Today it doesn't make much sense, since all ValueObjects prefer to store their types as TypeSystemSwiftTypeRef types, and dynamic type resolution is done using type metadata, and not in SwiftASTContext space. This avoids a very costly initialization of the Swift compiler triggered by ValueObjectDynamicValue. rdar://124487859
1 parent 5839da3 commit e472464

File tree

3 files changed

+0
-35
lines changed

3 files changed

+0
-35
lines changed

lldb/include/lldb/Core/ValueObjectDynamicValue.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -106,10 +106,6 @@ class ValueObjectDynamicValue : public ValueObject {
106106

107107
bool HasDynamicValueTypeInfo() override { return true; }
108108

109-
/// Determine whether the scratch AST context has been replaced
110-
/// since this dynamic type has been created.
111-
bool DynamicValueTypeInfoNeedsUpdate();
112-
113109
CompilerType GetCompilerTypeImpl() override;
114110

115111
Address m_address; ///< The variable that this value object is based upon

lldb/source/Core/ValueObject.cpp

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -129,17 +129,6 @@ bool ValueObject::UpdateValueIfNeeded(bool update_format) {
129129

130130
bool did_change_formats = false;
131131

132-
// BEGIN SWIFT
133-
// Swift: Check whether the dynamic type system became stale.
134-
if (m_dynamic_value) {
135-
auto *dyn_val = static_cast<ValueObjectDynamicValue *>(m_dynamic_value);
136-
if (dyn_val->DynamicValueTypeInfoNeedsUpdate()) {
137-
dyn_val->SetNeedsUpdate();
138-
SetNeedsUpdate();
139-
}
140-
}
141-
// END SWIFT
142-
143132
if (update_format)
144133
did_change_formats = UpdateFormatsIfNeeded();
145134

lldb/source/Core/ValueObjectDynamicValue.cpp

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -440,23 +440,3 @@ void ValueObjectDynamicValue::SetLanguageFlags(uint64_t flags) {
440440
else
441441
this->ValueObject::SetLanguageFlags(flags);
442442
}
443-
444-
bool ValueObjectDynamicValue::DynamicValueTypeInfoNeedsUpdate() {
445-
if (GetPreferredDisplayLanguage() != eLanguageTypeSwift)
446-
return false;
447-
448-
if (!m_dynamic_type_info.HasType())
449-
return false;
450-
451-
#ifdef LLDB_ENABLE_SWIFT
452-
auto cached_ctx = m_value.GetCompilerType().GetTypeSystem();
453-
std::optional<SwiftScratchContextReader> scratch_ctx(
454-
GetSwiftScratchContext());
455-
456-
if (!scratch_ctx || !cached_ctx)
457-
return true;
458-
return (void*)cached_ctx.GetSharedPointer().get() != (void*)scratch_ctx->get();
459-
#else // !LLDB_ENABLE_SWIFT
460-
return false;
461-
#endif // LLDB_ENABLE_SWIFT
462-
}

0 commit comments

Comments
 (0)