-
Notifications
You must be signed in to change notification settings - Fork 341
[lldb][progress] Improve Swift progress reporting #7769
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
[lldb][progress] Improve Swift progress reporting #7769
Conversation
LLDB's progress reporting infrastructure has had the ability to add details to an overall progress report (added in https://reviews.llvm.org/D143690) but this had yet to be implemented in existing progress reports. This commit adds this functionality to progress reports made for Swift operations (such as caching user imports) so that instead of sending several individual progress reports for each step in these operations, one progress report is created and then incrementally updated. Importing Swift modules takes place in the Swift compiler which uses a callback function so that LLDB can perform its progress report. This originally called into a function in `lldb_private::SwiftASTContext` but will instead use a lambda function to increment a locally created progress report. rdar://105286354
`PreModuleImportCallback` is a variable for a callback function used specifically by LLDB to report progress updates on importing Swift modules in LLDB. This commit adds a setter for `PreModuleImportCallback` for greater flexibility in LLDB and removes the reference to this variable in the constructor. Related to swiftlang/llvm-project#7769 rdar://105286354
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.
Nice! This just need some polishing and it should be good to go 🙂
@@ -8339,7 +8363,7 @@ bool SwiftASTContextForExpressions::CacheUserImports( | |||
source_file.walk(import_finder); | |||
|
|||
for (const auto &attributed_import : src_file_imports) { | |||
progress.Increment(++completion); | |||
progress.Increment(++completion, llvm::formatv("{0}", source_file.getFilename().str())); |
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.
ditto.
size_t completion = 0; | ||
for (const SourceModule &module : cu_imports) { | ||
progress.Increment(++completion); | ||
progress.Increment(++completion, llvm::formatv("{0}", module.path.back())); |
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.
ditto.
...PI/functionalities/progress_reporting/swift_progress_reporting/TestSwiftProgressReporting.py
Outdated
Show resolved
Hide resolved
...PI/functionalities/progress_reporting/swift_progress_reporting/TestSwiftProgressReporting.py
Outdated
Show resolved
Hide resolved
...PI/functionalities/progress_reporting/swift_progress_reporting/TestSwiftProgressReporting.py
Outdated
Show resolved
Hide resolved
@@ -1989,12 +1991,23 @@ SwiftASTContext::CreateInstance(lldb::LanguageType language, Module &module, | |||
{ | |||
LLDB_SCOPED_TIMERF("%s (getStdlibModule)", m_description.c_str()); | |||
const bool can_create = true; | |||
std::unique_ptr<lldb_private::Progress> progress = std::make_unique<lldb_private::Progress>("Importing Swift standard library modules"); |
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.
module
. AFAIK there is only one Swift
module that is being imported there.
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.
But IIUC, the swift standard library module can have dependencies that are also loaded implicitly right ?
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.
This works when the progress reports have details (e.g. Importing Swift module: Foundation
) but I think it would make the overall title a little less clear (i.e. having one main progress report that says Importing Swift module
even though multiple individual imports are about to be performed). I can change it but maybe we also have an overall title and then an Increment
title in addition to having details
?
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.
I agree with Chelsea here: From a user perspective, it will look like we're only importing a single module, where actually that one module import trigger many other modules to be imported. I think modules
makes more sense here.
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.
Swift has 1 dependency: SwiftShims, which isa Clang module. So I guess, you're right.
[&progress](llvm::StringRef module_name, bool is_overlay) { | ||
if (progress) { | ||
progress->Increment(1, module_name.str()); | ||
return true; |
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.
Out of curiosity: what does the return value do?
// shorter:
if (progress)
progress->Increment(1, module_name.str());
return progress;
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.
I think I had it this way because I thought the callback had to return a bool but I'm mistaken, I'll change it to your shorter way.
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.
I would suggest changing the callback to std::function<void(...)>
if the return value isn't used there.
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.
Noted, will change this
source_file.getFilename().data()), | ||
src_file_imports.size()); | ||
|
||
Progress progress("Caching Swift user imports from"); |
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.
This is very LLDB-centric language:
"Importing module used in expression"
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.
I can change this, but do we still want to tell users that Swift imports were cached?
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.
No, the existing wording confused even me (as someone familiar with the implementation) and I had to look at the code to understand what "caching" in this context is even supposed to mean.
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.
Interesting, for all progress reports I used the titles from the original implementation. If we're also telling the user that we're importing a module due to the use of an expression do we want to tell them what the expression that triggered the import was in the report? (this might be a bit overboard, I'm not sure if we even have the expression itself at this level)
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.
I don't think we can achieve that today since progress report can't be related one another. You can stack them but that don't necessarily means the one at the bottom of the stack is a parent of the one above. It would be a nice improvement for later though :)
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.
Yeah it would be nice to have this in the future 👍🏾
compile_unit->GetPrimaryFile().GetFilename()), | ||
cu_imports.size()); | ||
|
||
Progress progress("Getting Swift compile unit 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.
Suggestion: "Importing modules used by compilation unit {0}", compile_unit->GetPrimaryFile().GetFilename()
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.
Good suggestion, I'll change this.
@@ -3263,7 +3281,20 @@ swift::ModuleDecl *SwiftASTContext::GetModule(const SourceModule &module, | |||
auto import_diags = getScopedDiagnosticConsumer(); | |||
|
|||
// Perform the import. | |||
std::unique_ptr<lldb_private::Progress> progress = std::make_unique<lldb_private::Progress>("Importing Swift modules"); | |||
ast->SetPreModuleImportCallback( | |||
[&progress](llvm::StringRef module_name, bool is_overlay) { |
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.
@adrian-prantl My bad, the swift standard library module was not a good example. Here however, we could load modules are overlay right ? Do you think that the overlay part is relevant information for the user and print the following for instance:
Importing Swift Module: Darwin (overlay).
Or do you think it's not necessary to mention that it's an overlay:
Importing Swift Module: Darwin.
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.
Yes, because as your example illustrates, they come in pairs. A Clang module, and it's similarly named Swift overlay.
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.
Thank you for clarifying :)
Changes the titles of some progress reports to better reflect what operation is being done, updates the details sections when importing Swift modules to also report when Swift overlay modules are being imported and removes the boolean return types from the lambda functions used to increment progress reports. Also updates the API test to revert the formatting done by black and updates the progress titles checked by the test.
Remove unused import
swiftlang/swift#69730 |
swiftlang/swift#69730 |
Progress reports for importing a module used in an expression used the wrong variable to obtain the module's filename which caused the progress report to appear incorrect. This updates the filename used to be correct.
@@ -1989,12 +1990,21 @@ SwiftASTContext::CreateInstance(lldb::LanguageType language, Module &module, | |||
{ | |||
LLDB_SCOPED_TIMERF("%s (getStdlibModule)", m_description.c_str()); | |||
const bool can_create = true; | |||
std::unique_ptr<lldb_private::Progress> progress = std::make_unique<lldb_private::Progress>("Importing Swift standard library modules"); |
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.
Why do some of these progress options need to be wrapped in a std::unique_ptr
?
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.
Leftover from a previous implementation before the PreImport setter was added, this can be changed to just use the progress object itself instead of the unique pointer since it will be destroyed when it goes out of scope anyways.
Adds a call to `llvm::make_scope_exit` to clear the callback function by setting it to an empty lambda function to prevent an out-of-scope access to the progress variable.
swiftlang/swift#69730 |
The progress report objects used for Swift module importing used unique pointers as a leftover from a previous implementation. This commit removes them and changes them to regular `Progress` objects. Also corrects how overlay imports were reported in their update string as the logic to add the "(overlay)" word was reversed in their ternary statements.
m_completed = m_total; | ||
ReportProgress(); | ||
} | ||
ReportProgress(); |
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.
Shouldn't this go upstream?
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.
@chelcassanova This should go upstream, before you land this patch otherwise, you could get a merge conflict.
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.
This depends on llvm#73605. @chelcassanova make sure to cherrypick here the merge commit after you land it upstream ;)
@@ -1989,6 +1990,20 @@ SwiftASTContext::CreateInstance(lldb::LanguageType language, Module &module, | |||
{ | |||
LLDB_SCOPED_TIMERF("%s (getStdlibModule)", m_description.c_str()); | |||
const bool can_create = true; | |||
|
|||
// Report progress on module importing by using a callback function in swift::ASTContext | |||
Progress progress("Importing Swift standard library modules"); |
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.
Are there multiple standard library modules or is there one? I know it might be pulling in other modules as dependencies. I guess we could sidestep this by omitting "modules" at the end. @adrian-prantl WDYT?
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.
ping @chelcassanova
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.
"Modules" can be omitted here for clarity
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.
I don't understand ... you say it can be omitted but it's still in the PR 🧐 ...
Progress progress("Importing Swift standard library modules"); | |
Progress progress("Importing Swift standard library"); |
|
||
// 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) {}); |
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.
Does swift_ast_sp->m_ast_context_ap->SetPreModuleImportCallback({})
work?
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.
I tried it locally and it does, but per Augusto's comment we might want to set the callback function to a generic progress report in the event that a module import is triggered outside of these functions.
[&progress](llvm::StringRef module_name, bool is_overlay) { | ||
progress.Increment(1, (is_overlay ? module_name.str() + " (overlay)" : module_name.str())); | ||
} | ||
); |
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.
Needs to be clang-formatted.
|
||
// 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) {}); |
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.
If I understand correctly, today we'll always emit a generic progress of "Importing [overlay] module X" whenever a module is imported. With this change, we'll have better progress reporting messages, but won't report anything else that happens to be imported outside of these functions. Perhaps re-introduce the generic progress message in case modules are imported outside these functions?
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.
Good point, I hadn't thought about the scenario of module imports being triggered in LLDB outside of these functions. If that does happen and the callback function is generic then LLDB might not be able to give a detailed progress report (since the generic callback wouldn't have the context of which modules were imported or where the import took place from) but it still indicates that LLDB caused a Swift module import which the user would want to know.
`clang-format`s previous changes
Reuses `ReportModuleImportCallback` as a generic callback function that gets set upon scope exit instead of using a blank function so that Swift module imports are reported when the import is triggered outside of `SwiftASTContext::GetModule` and `SwiftASTContext::CreateInstance`.
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.
There are few things that need to change before this lands.
m_completed = m_total; | ||
ReportProgress(); | ||
} | ||
ReportProgress(); |
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.
@chelcassanova This should go upstream, before you land this patch otherwise, you could get a merge conflict.
@@ -1989,6 +1990,20 @@ SwiftASTContext::CreateInstance(lldb::LanguageType language, Module &module, | |||
{ | |||
LLDB_SCOPED_TIMERF("%s (getStdlibModule)", m_description.c_str()); | |||
const bool can_create = true; | |||
|
|||
// Report progress on module importing by using a callback function in swift::ASTContext | |||
Progress progress("Importing Swift standard library modules"); |
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.
ping @chelcassanova
bool SwiftASTContext::ReportModuleLoadingProgress(llvm::StringRef module_name, | ||
bool is_overlay) { | ||
Progress progress(llvm::formatv(is_overlay ? "Importing overlay module {0}" | ||
: "Importing module {0}", | ||
module_name) | ||
.str()); | ||
Progress progress("Importing Swift module"); | ||
return true; | ||
} |
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.
AFAIK, this is a no-op now. You can get rid of it.
// 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(ReportModuleLoadingProgress); }); |
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.
Can you try setting the callback to an empty lambda instead of reusing ReportModuleLoadingProgress
?
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.
I'm using a generic callback here to report on any module imports progress reports not caught by the current callback lambdas but this can be replaced with a generic module import progress report.
llvm::formatv("Getting Swift compile unit imports for '{0}'", | ||
compile_unit->GetPrimaryFile().GetFilename()), | ||
cu_imports.size()); | ||
|
||
Progress progress("Importing module used by compile unit"); | ||
size_t completion = 0; | ||
for (const SourceModule &module : cu_imports) { | ||
progress.Increment(++completion); | ||
progress.Increment( | ||
++completion, compile_unit->GetPrimaryFile().GetFilename().AsCString()); |
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.
I think this is wrong: You just moved the use of compile_unit
in the loop to use it in the message detail but it never changes. I think you should leave the progress message the same it was and use the SourceModule &module
variable to give extra information in the detailed messaged.
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.
Ah, I didn't notice that compile_unit
was the wrong variable to use here. @adrian-prantl made the suggestion to say "Importing module used by compile unit..." but maybe we could say something like "Importing module used by compile unit : " with the module as the detail but that might be overkill
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.
Why would that be overkill ?
/// Generic callback function used for progress reporting that gets | ||
/// invoked by the Swift compiler and gets set upon scope exit when | ||
/// a more detailed progress report was used as the callback | ||
static bool ReportModuleLoadingProgress(llvm::StringRef module_name, | ||
bool is_overlay); |
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.
I think we can just delete this if you replace it by an empty lambda.
…ss message Instead of clearing the pre module import callback with `ReportModuleLoadingProgress`, clear it with a lambda that uses a generic message to report Swift module importing that gets triggered outside of the places where Swift import progress reports are currently being made. Also, the progress title for Swift compile unit imports has been fixed and updated to show both the current compile unit and the module being imported, and the test has been updated to reflect this.
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.
Getting close but there are still a few things to change.
m_completed = m_total; | ||
ReportProgress(); | ||
} | ||
ReportProgress(); |
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.
This depends on llvm#73605. @chelcassanova make sure to cherrypick here the merge commit after you land it upstream ;)
@@ -1989,6 +1990,20 @@ SwiftASTContext::CreateInstance(lldb::LanguageType language, Module &module, | |||
{ | |||
LLDB_SCOPED_TIMERF("%s (getStdlibModule)", m_description.c_str()); | |||
const bool can_create = true; | |||
|
|||
// Report progress on module importing by using a callback function in swift::ASTContext | |||
Progress progress("Importing Swift standard library modules"); |
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.
I don't understand ... you say it can be omitted but it's still in the PR 🧐 ...
Progress progress("Importing Swift standard library modules"); | |
Progress progress("Importing Swift standard library"); |
|
||
// Report progress on module importing by using a callback function in | ||
// swift::ASTContext | ||
Progress progress("Importing Swift standard library modules"); |
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.
Same here, drop the "modules" part.
Progress progress("Importing Swift standard library modules"); | |
Progress progress("Importing Swift standard library"); |
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.
Not sure how I missed both of these, thanks for the correction!
auto on_exit = llvm::make_scope_exit([&]() { | ||
swift_ast_sp->m_ast_context_ap->SetPreModuleImportCallback( | ||
[](llvm::StringRef module_name, bool is_overlay) { | ||
Progress progress("Importing Swift modules"); |
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.
You can just call the constructor here, I don't think you need to create a progress
variable.
Progress progress("Importing Swift modules"); | |
Progress("Importing Swift modules"); |
auto on_exit = llvm::make_scope_exit([&]() { | ||
ast->SetPreModuleImportCallback( | ||
[](llvm::StringRef module_name, bool is_overlay) { | ||
Progress progress("Importing Swift modules"); |
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.
ditto.
Progress progress("Importing Swift modules"); | |
Progress("Importing Swift modules"); |
progress.Increment(++completion, | ||
module.GetFileSpec().GetFilename().AsCString()); |
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.
This looks wrong, you need to re-use the module_name
from the loop range declaration.
progress.Increment(++completion, | |
module.GetFileSpec().GetFilename().AsCString()); | |
progress.Increment(++completion, module_name); |
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.
Ah, I reused the original implementation grabbed the module name from its FileSpec so that's how I missed this
module.GetFileSpec().GetFilename().AsCString()), | ||
module_names.size()); | ||
|
||
Progress progress("Loading Swift module", module_names.size()); |
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.
We should experiment and see changing the progress title here is actually a good thing. Now you don't know what parent module are we loading the submodule for.
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.
Progress progress("Loading Swift module for parent module <parent_module_name>", module_names.size());
maybe?
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.
Or "Loading Swift module '<parent_module>'. Submodule: <details>
? The only thing is that the title would look empty when first displayed.
source_file.getFilename().data()), | ||
src_file_imports.size()); | ||
|
||
Progress progress("Importing module used in expression"); |
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.
Progress progress("Importing module used in expression"); | |
Progress progress("Importing modules used in expression"); |
/// Generic callback function used for progress reporting that gets | ||
/// invoked by the Swift compiler and gets set upon scope exit when | ||
/// a more detailed progress report was used as the callback | ||
static bool ReportModuleLoadingProgress(llvm::StringRef module_name, | ||
bool is_overlay); |
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.
This is still here ...
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.
Removed, I thought I took this out of the header 😓
…ion (llvm#73605) This commit allows a final progress report upon the destruction of the `Progress` object to happen at all times as opposed to when the progress was not completed. (cherry picked from commit c846f8b)
Retitles some progress reports to be more accurate and updates the test to match, removes the use of a local variable in the generic lambda function that clears the callback, remove `ReportModuleLoadingProgress` from SwiftASTContext's header file.
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.
LGTM with a comment! Thanks for your patience 😄
@@ -3916,7 +3916,10 @@ void SwiftASTContext::ValidateSectionModules( | |||
|
|||
Status error; | |||
|
|||
Progress progress("Loading Swift module", module_names.size()); | |||
Progress progress( | |||
llvm::formatv("Loading Swift module '{0}'. Submodule", |
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.
Sorry for going back and forth on this but "swift module submodule" sounds too repetitive. If we retitle it this way it addresses the repetitiveness.
llvm::formatv("Loading Swift module '{0}'. Submodule", | |
llvm::formatv("Loading Swift module '{0}' dependencies", |
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.
This is much better wording, I'll change the title here
Fixes API test so that it passes and changes the title of the progress for loading Swift modules for clarity
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.
LGTM
swiftlang/swift#69730 |
swiftlang/swift#69730 |
LLDB's progress reporting infrastructure has had the ability to add details to an overall progress report (added in https://reviews.llvm.org/D143690) but this had yet to be implemented in existing progress reports. This commit adds this functionality to progress reports made for Swift operations (such as caching user imports) so that instead of sending several individual progress reports for each step in these operations, one progress report is created and then incrementally updated. Importing Swift modules takes place in the Swift compiler which uses a callback function so that LLDB can perform its progress report. This originally called into a function in `lldb_private::SwiftASTContext` but will instead use a lambda function to increment a locally created progress report. Related to: swiftlang/swift#69730 rdar://105286354 (cherry picked from commit 4106480)
LLDB's progress reporting infrastructure has had the ability to add details to an overall progress report (added in
https://reviews.llvm.org/D143690) but this had yet to be implemented in existing progress reports. This commit adds this functionality to progress reports made for Swift operations (such as caching user imports) so that instead of sending several individual progress reports for each step in these operations, one progress report is created and then incrementally updated.
Importing Swift modules takes place in the Swift compiler which uses a callback function so that LLDB can perform its progress report. This originally called into a function in
lldb_private::SwiftASTContext
but will instead use a lambda function to increment a locally created progress report.Related to swiftlang/swift#69730
rdar://105286354