@@ -144,45 +144,49 @@ bool lldb_private::formatters::swift::IndexPath_SummaryProvider(
144
144
145
145
bool lldb_private::formatters::swift::Measurement_SummaryProvider (
146
146
ValueObject &valobj, Stream &stream, const TypeSummaryOptions &options) {
147
- static ConstString g_value (" value" );
148
- static ConstString g_unit (" unit" );
149
- static ConstString g__symbol (" _symbol" );
147
+ ValueObjectSP value_sp, symbol_sp;
150
148
151
- ValueObjectSP value_sp (valobj.GetChildAtNamePath ({g_value}));
152
- if (!value_sp)
153
- return false ;
149
+ value_sp = valobj.GetChildMemberWithName (" value" );
150
+ if (value_sp) {
151
+ // Measurement structure prior to macOS 14.
152
+ ValueObjectSP unit_sp (valobj.GetChildMemberWithName (" unit" ));
153
+ if (!unit_sp)
154
+ return false ;
154
155
155
- ValueObjectSP unit_sp (valobj.GetChildAtNamePath ({g_unit} ));
156
- if (!unit_sp )
157
- return false ;
156
+ ProcessSP process_sp (valobj.GetProcessSP ( ));
157
+ if (!process_sp )
158
+ return false ;
158
159
159
- ProcessSP process_sp (valobj. GetProcessSP () );
160
- if (!process_sp )
161
- return false ;
160
+ ObjCLanguageRuntime *objc_runtime = ObjCLanguageRuntime::Get (*process_sp );
161
+ if (!objc_runtime )
162
+ return false ;
162
163
163
- ObjCLanguageRuntime *objc_runtime =
164
- ObjCLanguageRuntime::Get (*process_sp);
165
- if (!objc_runtime)
166
- return false ;
164
+ auto descriptor_sp (objc_runtime->GetClassDescriptor (*unit_sp));
165
+ if (!descriptor_sp)
166
+ return false ;
167
167
168
- auto descriptor_sp (objc_runtime->GetClassDescriptor (*unit_sp));
169
- if (!descriptor_sp)
170
- return false ;
168
+ if (descriptor_sp->GetNumIVars () == 0 )
169
+ return false ;
171
170
172
- if (descriptor_sp->GetNumIVars () == 0 )
173
- return false ;
171
+ auto ivar = descriptor_sp->GetIVarAtIndex (0 );
172
+ if (!ivar.m_type .IsValid ())
173
+ return false ;
174
174
175
- auto ivar = descriptor_sp->GetIVarAtIndex (0 );
176
- if (!ivar.m_type .IsValid ())
177
- return false ;
175
+ symbol_sp =
176
+ unit_sp->GetSyntheticChildAtOffset (ivar.m_offset , ivar.m_type , true );
177
+ if (!symbol_sp)
178
+ return false ;
178
179
179
- ValueObjectSP symbol_sp (
180
- unit_sp->GetSyntheticChildAtOffset (ivar.m_offset , ivar.m_type , true ));
181
- if (!symbol_sp)
182
- return false ;
180
+ symbol_sp = symbol_sp->GetQualifiedRepresentationIfAvailable (
181
+ lldb::eDynamicDontRunTarget, true );
182
+ } else {
183
+ // Measurement structure as of macOS 14+.
184
+ value_sp = valobj.GetChildMemberWithName (" _doubleValue" );
185
+ symbol_sp = valobj.GetChildAtNamePath ({" unit" , " _symbol" });
186
+ }
183
187
184
- symbol_sp = symbol_sp-> GetQualifiedRepresentationIfAvailable (
185
- lldb::eDynamicDontRunTarget, true ) ;
188
+ if (!value_sp || ! symbol_sp)
189
+ return false ;
186
190
187
191
DataExtractor data_extractor;
188
192
Status error;
0 commit comments