kastiglione created this revision. kastiglione added a reviewer: JDevlieghere. Herald added a project: All. kastiglione requested review of this revision. Herald added a project: LLDB. Herald added a subscriber: lldb-commits.
Following the work done by @jdevlieghere in D143690 <https://reviews.llvm.org/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. Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D147248 Files: lldb/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp lldb/test/API/functionalities/progress_reporting/clang_modules/TestClangModuleBuildProgress.py Index: lldb/test/API/functionalities/progress_reporting/clang_modules/TestClangModuleBuildProgress.py =================================================================== --- lldb/test/API/functionalities/progress_reporting/clang_modules/TestClangModuleBuildProgress.py +++ lldb/test/API/functionalities/progress_reporting/clang_modules/TestClangModuleBuildProgress.py @@ -43,4 +43,4 @@ event = lldbutil.fetch_next_event(self, listener, broadcaster) payload = lldb.SBDebugger.GetProgressFromEvent(event) message = payload[0] - self.assertEqual(message, "Currently building module MyModule") + self.assertEqual(message, "Building Clang modules") Index: lldb/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp =================================================================== --- lldb/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp +++ lldb/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp @@ -68,7 +68,7 @@ private: bool HandleModuleRemark(const clang::Diagnostic &info); - void SetCurrentModuleProgress(llvm::StringRef module_name); + void SetCurrentModuleProgress(const std::string &module_name); typedef std::pair<clang::DiagnosticsEngine::Level, std::string> IDAndDiagnostic; @@ -208,8 +208,9 @@ if (m_module_build_stack.empty()) { m_current_progress_up = nullptr; } else { - // Update the progress to re-show the module that was currently being - // built from the time the now completed module was originally began. + // When the just completed module began building, a module that depends on + // it ("module A") was effectively paused. Update the progress to re-show + // "module A" as continuing to be built. const auto &resumed_module_name = m_module_build_stack.back(); SetCurrentModuleProgress(resumed_module_name); } @@ -224,13 +225,12 @@ } void StoringDiagnosticConsumer::SetCurrentModuleProgress( - llvm::StringRef module_name) { - // Ensure the ordering of: - // 1. Completing the existing progress event. - // 2. Beginining a new progress event. - m_current_progress_up = nullptr; - m_current_progress_up = std::make_unique<Progress>( - llvm::formatv("Currently building module {0}", module_name)); + const std::string &module_name) { + if (!m_current_progress_up) + m_current_progress_up = + std::make_unique<Progress>("Building Clang modules"); + + m_current_progress_up->Increment(1, module_name); } ClangModulesDeclVendor::ClangModulesDeclVendor()
Index: lldb/test/API/functionalities/progress_reporting/clang_modules/TestClangModuleBuildProgress.py =================================================================== --- lldb/test/API/functionalities/progress_reporting/clang_modules/TestClangModuleBuildProgress.py +++ lldb/test/API/functionalities/progress_reporting/clang_modules/TestClangModuleBuildProgress.py @@ -43,4 +43,4 @@ event = lldbutil.fetch_next_event(self, listener, broadcaster) payload = lldb.SBDebugger.GetProgressFromEvent(event) message = payload[0] - self.assertEqual(message, "Currently building module MyModule") + self.assertEqual(message, "Building Clang modules") Index: lldb/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp =================================================================== --- lldb/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp +++ lldb/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp @@ -68,7 +68,7 @@ private: bool HandleModuleRemark(const clang::Diagnostic &info); - void SetCurrentModuleProgress(llvm::StringRef module_name); + void SetCurrentModuleProgress(const std::string &module_name); typedef std::pair<clang::DiagnosticsEngine::Level, std::string> IDAndDiagnostic; @@ -208,8 +208,9 @@ if (m_module_build_stack.empty()) { m_current_progress_up = nullptr; } else { - // Update the progress to re-show the module that was currently being - // built from the time the now completed module was originally began. + // When the just completed module began building, a module that depends on + // it ("module A") was effectively paused. Update the progress to re-show + // "module A" as continuing to be built. const auto &resumed_module_name = m_module_build_stack.back(); SetCurrentModuleProgress(resumed_module_name); } @@ -224,13 +225,12 @@ } void StoringDiagnosticConsumer::SetCurrentModuleProgress( - llvm::StringRef module_name) { - // Ensure the ordering of: - // 1. Completing the existing progress event. - // 2. Beginining a new progress event. - m_current_progress_up = nullptr; - m_current_progress_up = std::make_unique<Progress>( - llvm::formatv("Currently building module {0}", module_name)); + const std::string &module_name) { + if (!m_current_progress_up) + m_current_progress_up = + std::make_unique<Progress>("Building Clang modules"); + + m_current_progress_up->Increment(1, module_name); } ClangModulesDeclVendor::ClangModulesDeclVendor()
_______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits