@@ -4209,6 +4209,7 @@ swift::Identifier SwiftASTContext::GetIdentifier(const llvm::StringRef &name) {
4209
4209
4210
4210
ConstString SwiftASTContext::GetMangledTypeName (swift::TypeBase *type_base) {
4211
4211
VALID_OR_RETURN (ConstString ());
4212
+ LLDB_SCOPED_TIMER ();
4212
4213
4213
4214
auto iter = m_type_to_mangled_name_map.find (type_base),
4214
4215
end = m_type_to_mangled_name_map.end ();
@@ -4269,6 +4270,7 @@ SwiftASTContext::GetTypeFromMangledTypename(ConstString mangled_typename) {
4269
4270
}
4270
4271
4271
4272
CompilerType SwiftASTContext::GetAsClangType (ConstString mangled_name) {
4273
+ LLDB_SCOPED_TIMER ();
4272
4274
if (!swift::Demangle::isObjCSymbol (mangled_name.GetStringRef ()))
4273
4275
return {};
4274
4276
@@ -4368,6 +4370,7 @@ swift::TypeBase *SwiftASTContext::ReconstructType(ConstString mangled_typename,
4368
4370
LOG_PRINTF (LIBLLDB_LOG_TYPES, " (\" %s\" ) -- not cached, searching" ,
4369
4371
mangled_cstr);
4370
4372
4373
+ LLDB_SCOPED_TIMERF (" %s (not cached)" , LLVM_PRETTY_FUNCTION);
4371
4374
found_type = swift::Demangle::getTypeForMangling (
4372
4375
*ast_ctx, mangled_typename.GetStringRef ())
4373
4376
.getPointer ();
@@ -4514,6 +4517,7 @@ SwiftASTContext::FindContainedTypeOrDecl(llvm::StringRef name,
4514
4517
TypeOrDecl container_type_or_decl,
4515
4518
TypesOrDecls &results, bool append) {
4516
4519
VALID_OR_RETURN (0 );
4520
+ LLDB_SCOPED_TIMER ();
4517
4521
4518
4522
if (!append)
4519
4523
results.clear ();
@@ -4562,7 +4566,7 @@ llvm::Optional<SwiftASTContext::TypeOrDecl>
4562
4566
SwiftASTContext::FindTypeOrDecl (const char *name,
4563
4567
swift::ModuleDecl *swift_module) {
4564
4568
VALID_OR_RETURN (llvm::Optional<SwiftASTContext::TypeOrDecl>());
4565
-
4569
+
4566
4570
TypesOrDecls search_results;
4567
4571
4568
4572
FindTypesOrDecls (name, swift_module, search_results, false );
@@ -4648,6 +4652,7 @@ size_t SwiftASTContext::FindTypesOrDecls(const char *name,
4648
4652
size_t SwiftASTContext::FindType (const char *name,
4649
4653
std::set<CompilerType> &results, bool append) {
4650
4654
VALID_OR_RETURN (0 );
4655
+ LLDB_SCOPED_TIMER ();
4651
4656
4652
4657
if (!append)
4653
4658
results.clear ();
@@ -4675,6 +4680,7 @@ size_t SwiftASTContext::FindType(const char *name,
4675
4680
4676
4681
CompilerType SwiftASTContext::ImportType (CompilerType &type, Status &error) {
4677
4682
VALID_OR_RETURN (CompilerType ());
4683
+ LLDB_SCOPED_TIMER ();
4678
4684
4679
4685
if (m_ast_context_ap.get () == NULL )
4680
4686
return CompilerType ();
@@ -4928,6 +4934,7 @@ void SwiftASTContext::AddErrorStatusAsGenericDiagnostic(Status error) {
4928
4934
void SwiftASTContext::PrintDiagnostics (DiagnosticManager &diagnostic_manager,
4929
4935
uint32_t bufferID, uint32_t first_line,
4930
4936
uint32_t last_line) {
4937
+ LLDB_SCOPED_TIMER ();
4931
4938
// If this is a fatal error, copy the error into the AST context's
4932
4939
// fatal error field, and then put it to the stream, otherwise just
4933
4940
// dump the diagnostics to the stream.
@@ -5241,6 +5248,7 @@ bool SwiftASTContext::IsPossibleDynamicType(opaque_compiler_type_t type,
5241
5248
bool check_cplusplus,
5242
5249
bool check_objc) {
5243
5250
VALID_OR_RETURN_CHECK_TYPE (type, false );
5251
+ LLDB_SCOPED_TIMER ();
5244
5252
5245
5253
auto can_type = GetCanonicalSwiftType (type);
5246
5254
if (!can_type)
@@ -5340,6 +5348,7 @@ bool SwiftASTContext::IsFullyRealized(const CompilerType &compiler_type) {
5340
5348
5341
5349
bool SwiftASTContext::GetProtocolTypeInfo (const CompilerType &type,
5342
5350
ProtocolInfo &protocol_info) {
5351
+ LLDB_SCOPED_TIMER ();
5343
5352
if (swift::CanType swift_can_type = ::GetCanonicalSwiftType (type)) {
5344
5353
if (!swift_can_type.isExistentialType ())
5345
5354
return false ;
@@ -5419,6 +5428,7 @@ SwiftASTContext::GetTypeRefType(lldb::opaque_compiler_type_t type) {
5419
5428
ConstString SwiftASTContext::GetTypeName (opaque_compiler_type_t type) {
5420
5429
VALID_OR_RETURN_CHECK_TYPE (
5421
5430
type, ConstString (" <invalid Swift context or opaque type>" ));
5431
+ LLDB_SCOPED_TIMER ();
5422
5432
std::string type_name;
5423
5433
swift::Type swift_type (GetSwiftType (type));
5424
5434
@@ -5442,6 +5452,7 @@ ConstString SwiftASTContext::GetTypeName(opaque_compiler_type_t type) {
5442
5452
static llvm::DenseMap<swift::CanType, swift::Identifier>
5443
5453
GetArchetypeNames (swift::Type swift_type, swift::ASTContext &ast_ctx,
5444
5454
const SymbolContext *sc) {
5455
+ LLDB_SCOPED_TIMER ();
5445
5456
llvm::DenseMap<swift::CanType, swift::Identifier> dict;
5446
5457
5447
5458
assert (&swift_type->getASTContext () == &ast_ctx);
@@ -5469,6 +5480,7 @@ ConstString SwiftASTContext::GetDisplayTypeName(opaque_compiler_type_t type,
5469
5480
const SymbolContext *sc) {
5470
5481
VALID_OR_RETURN_CHECK_TYPE (
5471
5482
type, ConstString (" <invalid Swift context or opaque type>" ));
5483
+ LLDB_SCOPED_TIMER ();
5472
5484
std::string type_name (GetTypeName (type).AsCString (" " ));
5473
5485
if (type) {
5474
5486
swift::Type swift_type (GetSwiftType (type));
@@ -5487,6 +5499,7 @@ uint32_t
5487
5499
SwiftASTContext::GetTypeInfo (opaque_compiler_type_t type,
5488
5500
CompilerType *pointee_or_element_clang_type) {
5489
5501
VALID_OR_RETURN_CHECK_TYPE (type, 0 );
5502
+ LLDB_SCOPED_TIMER ();
5490
5503
5491
5504
if (pointee_or_element_clang_type)
5492
5505
pointee_or_element_clang_type->Clear ();
@@ -5810,6 +5823,7 @@ TypeMemberFunctionImpl
5810
5823
SwiftASTContext::GetMemberFunctionAtIndex (opaque_compiler_type_t type,
5811
5824
size_t idx) {
5812
5825
VALID_OR_RETURN_CHECK_TYPE (type, TypeMemberFunctionImpl ());
5826
+ LLDB_SCOPED_TIMER ();
5813
5827
5814
5828
std::string name (" " );
5815
5829
CompilerType result_type;
@@ -5983,6 +5997,7 @@ llvm::Optional<uint64_t>
5983
5997
SwiftASTContext::GetBitSize (opaque_compiler_type_t type,
5984
5998
ExecutionContextScope *exe_scope) {
5985
5999
VALID_OR_RETURN_CHECK_TYPE (type, llvm::None);
6000
+ LLDB_SCOPED_TIMER ();
5986
6001
5987
6002
// If the type has type parameters, bind them first.
5988
6003
swift::CanType swift_can_type (GetCanonicalSwiftType (type));
@@ -6032,6 +6047,7 @@ llvm::Optional<uint64_t>
6032
6047
SwiftASTContext::GetByteStride (opaque_compiler_type_t type,
6033
6048
ExecutionContextScope *exe_scope) {
6034
6049
VALID_OR_RETURN_CHECK_TYPE (type, llvm::None);
6050
+ LLDB_SCOPED_TIMER ();
6035
6051
6036
6052
// If the type has type parameters, bind them first.
6037
6053
swift::CanType swift_can_type (GetCanonicalSwiftType (type));
@@ -6064,6 +6080,7 @@ llvm::Optional<size_t>
6064
6080
SwiftASTContext::GetTypeBitAlign (opaque_compiler_type_t type,
6065
6081
ExecutionContextScope *exe_scope) {
6066
6082
VALID_OR_RETURN_CHECK_TYPE (type, llvm::None);
6083
+ LLDB_SCOPED_TIMER ();
6067
6084
6068
6085
// If the type has type parameters, bind them first.
6069
6086
swift::CanType swift_can_type (GetCanonicalSwiftType (type));
@@ -6264,6 +6281,7 @@ uint32_t SwiftASTContext::GetNumChildren(opaque_compiler_type_t type,
6264
6281
bool omit_empty_base_classes,
6265
6282
const ExecutionContext *exe_ctx) {
6266
6283
VALID_OR_RETURN_CHECK_TYPE (type, 0 );
6284
+ LLDB_SCOPED_TIMER ();
6267
6285
6268
6286
uint32_t num_children = 0 ;
6269
6287
@@ -6605,6 +6623,7 @@ CompilerType SwiftASTContext::GetFieldAtIndex(opaque_compiler_type_t type,
6605
6623
uint32_t *bitfield_bit_size_ptr,
6606
6624
bool *is_bitfield_ptr) {
6607
6625
VALID_OR_RETURN_CHECK_TYPE (type, CompilerType ());
6626
+ LLDB_SCOPED_TIMER ();
6608
6627
6609
6628
swift::CanType swift_can_type (GetCanonicalSwiftType (type));
6610
6629
@@ -6936,6 +6955,7 @@ CompilerType SwiftASTContext::GetChildCompilerTypeAtIndex(
6936
6955
bool &child_is_base_class, bool &child_is_deref_of_parent,
6937
6956
ValueObject *valobj, uint64_t &language_flags) {
6938
6957
VALID_OR_RETURN_CHECK_TYPE (type, CompilerType ());
6958
+ LLDB_SCOPED_TIMER ();
6939
6959
6940
6960
auto get_type_size = [&exe_ctx](uint32_t &result, CompilerType type) {
6941
6961
auto *exe_scope =
@@ -7242,6 +7262,7 @@ size_t SwiftASTContext::GetIndexOfChildMemberWithName(
7242
7262
opaque_compiler_type_t type, const char *name, ExecutionContext *exe_ctx,
7243
7263
bool omit_empty_base_classes, std::vector<uint32_t > &child_indexes) {
7244
7264
VALID_OR_RETURN_CHECK_TYPE (type, 0 );
7265
+ LLDB_SCOPED_TIMER ();
7245
7266
7246
7267
if (name && name[0 ]) {
7247
7268
swift::CanType swift_can_type (GetCanonicalSwiftType (type));
@@ -7607,6 +7628,7 @@ bool SwiftASTContext::DumpTypeValue(
7607
7628
size_t byte_size, uint32_t bitfield_bit_size, uint32_t bitfield_bit_offset,
7608
7629
ExecutionContextScope *exe_scope, bool is_base_class) {
7609
7630
VALID_OR_RETURN_CHECK_TYPE (type, false );
7631
+ LLDB_SCOPED_TIMER ();
7610
7632
7611
7633
swift::CanType swift_can_type (GetCanonicalSwiftType (type));
7612
7634
@@ -7773,7 +7795,7 @@ bool SwiftASTContext::DumpTypeValue(
7773
7795
bool SwiftASTContext::IsImportedType (opaque_compiler_type_t type,
7774
7796
CompilerType *original_type) {
7775
7797
VALID_OR_RETURN_CHECK_TYPE (type, false );
7776
-
7798
+ LLDB_SCOPED_TIMER ();
7777
7799
bool success = false ;
7778
7800
7779
7801
if (swift::Type swift_can_type = GetSwiftType (type)) {
@@ -7892,6 +7914,7 @@ void SwiftASTContext::DumpTypeDescription(opaque_compiler_type_t type,
7892
7914
bool print_help_if_available,
7893
7915
bool print_extensions_if_available,
7894
7916
lldb::DescriptionLevel level) {
7917
+ LLDB_SCOPED_TIMER ();
7895
7918
const auto initial_written_bytes = s->GetWrittenBytes ();
7896
7919
7897
7920
if (type) {
@@ -8193,6 +8216,7 @@ static swift::ModuleDecl *LoadOneModule(const SourceModule &module,
8193
8216
SwiftASTContext &swift_ast_context,
8194
8217
lldb::StackFrameWP &stack_frame_wp,
8195
8218
Status &error) {
8219
+ LLDB_SCOPED_TIMER ();
8196
8220
if (!module .path .size ())
8197
8221
return nullptr ;
8198
8222
@@ -8253,6 +8277,7 @@ bool SwiftASTContext::GetImplicitImports(
8253
8277
llvm::SmallVectorImpl<swift::AttributedImport<swift::ImportedModule>>
8254
8278
&modules,
8255
8279
Status &error) {
8280
+ LLDB_SCOPED_TIMER ();
8256
8281
if (!swift_ast_context.GetCompileUnitImports (sc, stack_frame_wp, modules,
8257
8282
error)) {
8258
8283
return false ;
@@ -8348,6 +8373,7 @@ bool SwiftASTContext::GetCompileUnitImportsImpl(
8348
8373
llvm::SmallVectorImpl<swift::AttributedImport<swift::ImportedModule>>
8349
8374
*modules,
8350
8375
Status &error) {
8376
+ LLDB_SCOPED_TIMER ();
8351
8377
CompileUnit *compile_unit = sc.comp_unit ;
8352
8378
if (compile_unit)
8353
8379
// Check the cache if this compile unit's imports were previously
0 commit comments