JDevlieghere created this revision. JDevlieghere added a reviewer: wallace. Herald added a project: All. JDevlieghere requested review of this revision.
Use a switch to avoid else-after-return. 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 {
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 {
_______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits