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

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


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG719506769a89: [lldb-vscode] Use a switch to avoid else-after-return (NFC) (authored by JDevlieghere).
Herald added a project: LLDB.

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D158788/new/

https://reviews.llvm.org/D158788

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


Index: lldb/tools/lldb-vscode/ProgressEvent.cpp
===================================================================
--- lldb/tools/lldb-vscode/ProgressEvent.cpp
+++ 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 @@
 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 {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D158788.553288.patch
Type: text/x-patch
Size: 920 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20230824/72d260ce/attachment.bin>


More information about the lldb-commits mailing list