[Lldb-commits] [lldb] 7195067 - [lldb-vscode] Use a switch to avoid else-after-return (NFC)

Jonas Devlieghere via lldb-commits lldb-commits at lists.llvm.org
Thu Aug 24 15:53:20 PDT 2023


Author: Jonas Devlieghere
Date: 2023-08-24T15:53:14-07:00
New Revision: 719506769a89c4f01fc8513cf3553e723591294c

URL: https://github.com/llvm/llvm-project/commit/719506769a89c4f01fc8513cf3553e723591294c
DIFF: https://github.com/llvm/llvm-project/commit/719506769a89c4f01fc8513cf3553e723591294c.diff

LOG: [lldb-vscode] Use a switch to avoid else-after-return (NFC)

Use a switch to avoid else-after-return.

Differential revision: https://reviews.llvm.org/D158788

Added: 
    

Modified: 
    lldb/tools/lldb-vscode/ProgressEvent.cpp

Removed: 
    


################################################################################
diff  --git a/lldb/tools/lldb-vscode/ProgressEvent.cpp b/lldb/tools/lldb-vscode/ProgressEvent.cpp
index 443d04892b4221..2930b5c1e24e92 100644
--- a/lldb/tools/lldb-vscode/ProgressEvent.cpp
+++ b/lldb/tools/lldb-vscode/ProgressEvent.cpp
@@ -9,6 +9,7 @@
 #include "ProgressEvent.h"
 
 #include "JSONUtils.h"
+#include "llvm/Support/ErrorHandling.h"
 #include <optional>
 
 using namespace lldb_vscode;
@@ -91,12 +92,15 @@ bool ProgressEvent::EqualsForIDE(const ProgressEvent &other) const {
 ProgressEventType ProgressEvent::GetEventType() const { return m_event_type; }
 
 StringRef ProgressEvent::GetEventName() const {
-  if (m_event_type == progressStart)
+  switch (m_event_type) {
+  case progressStart:
     return "progressStart";
-  else if (m_event_type == progressEnd)
-    return "progressEnd";
-  else
+  case progressUpdate:
     return "progressUpdate";
+  case progressEnd:
+    return "progressEnd";
+  }
+  llvm_unreachable("All cases handled above!");
 }
 
 json::Value ProgressEvent::ToJSON() const {


        


More information about the lldb-commits mailing list