[Lldb-commits] [lldb] [lldb][progress] Add progress manager class (PR #81319)

Greg Clayton via lldb-commits lldb-commits at lists.llvm.org
Fri Feb 9 14:49:03 PST 2024


================
@@ -119,6 +120,32 @@ class Progress {
   bool m_complete = false;
 };
 
+/// A class used to group progress reports by category. This is done by using a
+/// map that maintains a refcount of each category of progress reports that have
+/// come in. Keeping track of progress reports this way will be done if a
+/// debugger is listening to the eBroadcastBitProgressByCategory broadcast bit.
+class ProgressManager {
+public:
+  ProgressManager();
+  ~ProgressManager();
+
+  static void Initialize();
+  static void Terminate();
+  // Control the refcount of the progress report category as needed
+  void Increment(std::string);
+  void Decrement(std::string);
+
+  // Public accessor for the class instance
+  static ProgressManager &Instance();
+
+private:
+  // Manage the class instance internally using a std::optional
+  static std::optional<ProgressManager> &InstanceImpl();
+
+  llvm::StringMap<uint64_t> m_progress_map;
----------------
clayborg wrote:

maybe `m_category_map`?

https://github.com/llvm/llvm-project/pull/81319


More information about the lldb-commits mailing list