-
Notifications
You must be signed in to change notification settings - Fork 341
Add progress reports for bridging header compilation. #8103
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2060,16 +2060,19 @@ SwiftASTContext::CreateInstance(lldb::LanguageType language, Module &module, | |
// swift::ASTContext | ||
Progress progress("Importing Swift standard library"); | ||
swift_ast_sp->m_ast_context_ap->SetPreModuleImportCallback( | ||
[&progress](llvm::StringRef module_name, bool is_overlay) { | ||
progress.Increment(1, (is_overlay ? module_name.str() + " (overlay)" | ||
: module_name.str())); | ||
[&progress](llvm::StringRef module_name, | ||
swift::ASTContext::ModuleImportKind kind) { | ||
progress.Increment(1, (kind == swift::ASTContext::Overlay | ||
? module_name.str() + " (overlay)" | ||
: module_name.str())); | ||
}); | ||
|
||
// Clear the callback function on scope exit to prevent an out-of-scope | ||
// access of the progress local variable | ||
auto on_exit = llvm::make_scope_exit([&]() { | ||
swift_ast_sp->m_ast_context_ap->SetPreModuleImportCallback( | ||
[](llvm::StringRef module_name, bool is_overlay) { | ||
[](llvm::StringRef module_name, | ||
swift::ASTContext::ModuleImportKind kind) { | ||
Progress("Importing Swift modules"); | ||
}); | ||
}); | ||
|
@@ -2569,19 +2572,22 @@ lldb::TypeSystemSP SwiftASTContext::CreateInstance( | |
const bool can_create = true; | ||
|
||
// Report progress on module importing by using a callback function in | ||
// swift::ASTContext | ||
// swift::ASTContext. | ||
Progress progress("Importing Swift standard library"); | ||
swift_ast_sp->m_ast_context_ap->SetPreModuleImportCallback( | ||
[&progress](llvm::StringRef module_name, bool is_overlay) { | ||
progress.Increment(1, (is_overlay ? module_name.str() + " (overlay)" | ||
: module_name.str())); | ||
[&progress](llvm::StringRef module_name, | ||
swift::ASTContext::ModuleImportKind kind) { | ||
progress.Increment(1, (kind == swift::ASTContext::Overlay | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ditto |
||
? module_name.str() + " (overlay)" | ||
: module_name.str())); | ||
}); | ||
|
||
// Clear the callback function on scope exit to prevent an out-of-scope | ||
// access of the progress local variable | ||
// access of the progress local variable. | ||
auto on_exit = llvm::make_scope_exit([&]() { | ||
swift_ast_sp->m_ast_context_ap->SetPreModuleImportCallback( | ||
[](llvm::StringRef module_name, bool is_overlay) { | ||
[](llvm::StringRef module_name, | ||
swift::ASTContext::ModuleImportKind kind) { | ||
Progress("Importing Swift modules"); | ||
}); | ||
}); | ||
|
@@ -3627,19 +3633,31 @@ swift::ModuleDecl *SwiftASTContext::GetModule(const SourceModule &module, | |
auto import_diags = getScopedDiagnosticConsumer(); | ||
|
||
// Report progress on module importing by using a callback function in | ||
// swift::ASTContext | ||
// swift::ASTContext. | ||
Progress progress("Importing Swift modules"); | ||
ast->SetPreModuleImportCallback([&progress](llvm::StringRef module_name, | ||
bool is_overlay) { | ||
progress.Increment( | ||
1, (is_overlay ? module_name.str() + " (overlay)" : module_name.str())); | ||
}); | ||
ast->SetPreModuleImportCallback( | ||
[&progress](llvm::StringRef module_name, | ||
swift::ASTContext::ModuleImportKind kind) { | ||
switch (kind) { | ||
case swift::ASTContext::Module: | ||
progress.Increment(1, module_name.str()); | ||
break; | ||
case swift::ASTContext::Overlay: | ||
progress.Increment(1, module_name.str() + " (overlay)"); | ||
break; | ||
case swift::ASTContext::BridgingHeader: | ||
progress.Increment(1, | ||
"Compiling bridging header: " + module_name.str()); | ||
break; | ||
Comment on lines
+3642
to
+3651
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In the I don't have any preference but let's stay consistent across all the |
||
} | ||
}); | ||
|
||
// Clear the callback function on scope exit to prevent an out-of-scope access | ||
// of the progress local variable | ||
auto on_exit = llvm::make_scope_exit([&]() { | ||
ast->SetPreModuleImportCallback( | ||
[](llvm::StringRef module_name, bool is_overlay) { | ||
[](llvm::StringRef module_name, | ||
swift::ASTContext::ModuleImportKind kind) { | ||
Progress("Importing Swift modules"); | ||
}); | ||
}); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
struct FromBridgingHeader {}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we have a switch here now that we have 3 kinds of module imports ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Honestly I think even the overlay case makes no sense here since the stdlib is always a pure Swift module. I just left it in because it was there before.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fair