Skip to content

Commit d88fac5

Browse files
committed
[lldb] Add lookup failures to TypeSystemSwiftTypeRef's clang type cache
By profiling LLDB running frame variable in a large application with many many .o files, I noticed that one of the biggest bottlenecks of the operation was looking (and failing) to find a certain potential clang type over and over again.
1 parent 7725fb2 commit d88fac5

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

lldb/source/Plugins/TypeSystem/Swift/TypeSystemSwiftTypeRef.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -451,6 +451,10 @@ TypeSP TypeSystemSwiftTypeRefForExpressions::LookupClangType(
451451
if (TargetSP target_sp = GetTargetWP().lock())
452452
target_sp->GetImages().ForEach(lookup);
453453

454+
/// Cache the negative result. This is safe to do because ModulesDidLoad will
455+
/// clear the cache.
456+
if (!result)
457+
m_clang_type_cache.Insert(name.AsCString(), result);
454458
return result;
455459
}
456460

0 commit comments

Comments
 (0)