[Lldb-commits] [PATCH] D120100: [lldb] Expose eBroadcastBitProgress to the SWIG SBAPI (NFC)

Med Ismail Bennani via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Thu Feb 17 16:41:45 PST 2022


mib created this revision.
mib added reviewers: clayborg, JDevlieghere, jingham.
mib added a project: LLDB.
mib requested review of this revision.
Herald added a subscriber: lldb-commits.

This patch removes the multiple definitions of the eBroadcastBitProgress
enum in `Debugger` and `SBDebugger` headers and moves it to lldb-enumeration
header instead.

By doing so, it eleviates the need to redefine a third time the
enumeration in a SWIG interface file (to access it from Python) and
makes it easier to maintain if other progress event types are added to
the enum in the future.

This patch also updates all the locations that were the previous
definitions to use the new one.

Signed-off-by: Med Ismail Bennani <medismail.bennani at gmail.com>


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D120100

Files:
  lldb/include/lldb/API/SBDebugger.h
  lldb/include/lldb/Core/Debugger.h
  lldb/include/lldb/lldb-enumerations.h
  lldb/source/Core/Debugger.cpp
  lldb/tools/lldb-vscode/lldb-vscode.cpp


Index: lldb/tools/lldb-vscode/lldb-vscode.cpp
===================================================================
--- lldb/tools/lldb-vscode/lldb-vscode.cpp
+++ lldb/tools/lldb-vscode/lldb-vscode.cpp
@@ -386,8 +386,8 @@
 
 void ProgressEventThreadFunction() {
   lldb::SBListener listener("lldb-vscode.progress.listener");
-  g_vsc.debugger.GetBroadcaster().AddListener(
-      listener, lldb::SBDebugger::eBroadcastBitProgress);
+  g_vsc.debugger.GetBroadcaster().AddListener(listener,
+                                              lldb::eBroadcastBitProgress);
   g_vsc.broadcaster.AddListener(listener, eBroadcastBitStopProgressThread);
   lldb::SBEvent event;
   bool done = false;
Index: lldb/source/Core/Debugger.cpp
===================================================================
--- lldb/source/Core/Debugger.cpp
+++ lldb/source/Core/Debugger.cpp
@@ -1293,7 +1293,7 @@
                                   uint64_t completed, uint64_t total,
                                   bool is_debugger_specific) {
   // Only deliver progress events if we have any progress listeners.
-  const uint32_t event_type = Debugger::eBroadcastBitProgress;
+  const uint32_t event_type = eBroadcastBitProgress;
   if (!debugger.GetBroadcaster().EventTypeHasListeners(event_type))
     return;
   EventSP event_sp(new Event(event_type, new Debugger::ProgressEventData(
Index: lldb/include/lldb/lldb-enumerations.h
===================================================================
--- lldb/include/lldb/lldb-enumerations.h
+++ lldb/include/lldb/lldb-enumerations.h
@@ -427,6 +427,8 @@
     eWatchpointEventTypeThreadChanged = (1u << 11),
     eWatchpointEventTypeTypeChanged = (1u << 12)};
 
+FLAGS_ENUM(ProgressEventType){eBroadcastBitProgress = (1 << 0)};
+
 /// Programming language type.
 ///
 /// These enumerations use the same language enumerations as the DWARF
Index: lldb/include/lldb/Core/Debugger.h
===================================================================
--- lldb/include/lldb/Core/Debugger.h
+++ lldb/include/lldb/Core/Debugger.h
@@ -73,11 +73,6 @@
   friend class SourceManager; // For GetSourceFileCache.
 
 public:
-  /// Broadcaster event bits definitions.
-  enum {
-    eBroadcastBitProgress = (1 << 0),
-  };
-
   static ConstString GetStaticBroadcasterClass();
 
   /// Get the public broadcaster for this debugger.
Index: lldb/include/lldb/API/SBDebugger.h
===================================================================
--- lldb/include/lldb/API/SBDebugger.h
+++ lldb/include/lldb/API/SBDebugger.h
@@ -33,8 +33,6 @@
 
 class LLDB_API SBDebugger {
 public:
-  FLAGS_ANONYMOUS_ENUM(){eBroadcastBitProgress = (1 << 0)};
-
   SBDebugger();
 
   SBDebugger(const lldb::SBDebugger &rhs);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D120100.409818.patch
Type: text/x-patch
Size: 2714 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20220218/89ea0161/attachment.bin>


More information about the lldb-commits mailing list