Skip to content

Commit 7edff3c

Browse files
committed
[lldb] Use one Progress event per root module build
Following the work done by @JDevlieghere in D143690, this changes how Clang module build events are emitted. Instead of one Progress event per module being built, a single Progress event is used to encompass all modules, and each module build is sent as an `Increment` update. Differential Revision: https://reviews.llvm.org/D147248
1 parent c8522ca commit 7edff3c

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

lldb/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp

+10-10
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ class StoringDiagnosticConsumer : public clang::DiagnosticConsumer {
6868

6969
private:
7070
bool HandleModuleRemark(const clang::Diagnostic &info);
71-
void SetCurrentModuleProgress(llvm::StringRef module_name);
71+
void SetCurrentModuleProgress(std::string module_name);
7272

7373
typedef std::pair<clang::DiagnosticsEngine::Level, std::string>
7474
IDAndDiagnostic;
@@ -208,8 +208,9 @@ bool StoringDiagnosticConsumer::HandleModuleRemark(
208208
if (m_module_build_stack.empty()) {
209209
m_current_progress_up = nullptr;
210210
} else {
211-
// Update the progress to re-show the module that was currently being
212-
// built from the time the now completed module was originally began.
211+
// When the just completed module began building, a module that depends on
212+
// it ("module A") was effectively paused. Update the progress to re-show
213+
// "module A" as continuing to be built.
213214
const auto &resumed_module_name = m_module_build_stack.back();
214215
SetCurrentModuleProgress(resumed_module_name);
215216
}
@@ -224,13 +225,12 @@ bool StoringDiagnosticConsumer::HandleModuleRemark(
224225
}
225226

226227
void StoringDiagnosticConsumer::SetCurrentModuleProgress(
227-
llvm::StringRef module_name) {
228-
// Ensure the ordering of:
229-
// 1. Completing the existing progress event.
230-
// 2. Beginining a new progress event.
231-
m_current_progress_up = nullptr;
232-
m_current_progress_up = std::make_unique<Progress>(
233-
llvm::formatv("Currently building module {0}", module_name));
228+
std::string module_name) {
229+
if (!m_current_progress_up)
230+
m_current_progress_up =
231+
std::make_unique<Progress>("Building Clang modules");
232+
233+
m_current_progress_up->Increment(1, std::move(module_name));
234234
}
235235

236236
ClangModulesDeclVendor::ClangModulesDeclVendor()

lldb/test/API/functionalities/progress_reporting/clang_modules/TestClangModuleBuildProgress.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,4 +43,4 @@ def test_clang_module_build_progress_report(self):
4343
event = lldbutil.fetch_next_event(self, listener, broadcaster)
4444
payload = lldb.SBDebugger.GetProgressFromEvent(event)
4545
message = payload[0]
46-
self.assertEqual(message, "Currently building module MyModule")
46+
self.assertEqual(message, "Building Clang modules")

0 commit comments

Comments
 (0)