https://github.com/Nerixyz created 
https://github.com/llvm/llvm-project/pull/215313

MSVC warns with 
[C4715](https://learn.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warning-level-1-c4715)
 about missing returns in functions where a `switch` over and enum handles all 
names enumerators, because the enum could hold unnamed values.  For example, 
given an `enum class Foo { Bar, Baz }` a function handles both `Bar` and `Baz` 
by returning a value, Clang and GCC won't issue warnings, but MSVC will. 

This handles the cases in the two locations I found.

>From 219f7cd801f40bc54e553b4257f6027ea44570ac Mon Sep 17 00:00:00 2001
From: Nerixyz <[email protected]>
Date: Mon, 10 Aug 2026 17:44:26 +0200
Subject: [PATCH] [lldb] Fix MSVC warnings about missing return values

---
 lldb/source/Plugins/Language/CPlusPlus/LibCxxVector.cpp | 3 +++
 lldb/tools/lldb-dap/Protocol/ProtocolEvents.cpp         | 3 +++
 2 files changed, 6 insertions(+)

diff --git a/lldb/source/Plugins/Language/CPlusPlus/LibCxxVector.cpp 
b/lldb/source/Plugins/Language/CPlusPlus/LibCxxVector.cpp
index 4966eb1d75b20..79fe98a6e9d15 100644
--- a/lldb/source/Plugins/Language/CPlusPlus/LibCxxVector.cpp
+++ b/lldb/source/Plugins/Language/CPlusPlus/LibCxxVector.cpp
@@ -137,6 +137,9 @@ llvm::Expected<uint32_t> lldb_private::formatters::
   case VectorLayout::Size:
     return GetNumChildren(m_finish);
   }
+
+  assert(false && "invalid vector layout");
+  return llvm::createStringError("invalid vector layout");
 }
 
 lldb::ValueObjectSP
diff --git a/lldb/tools/lldb-dap/Protocol/ProtocolEvents.cpp 
b/lldb/tools/lldb-dap/Protocol/ProtocolEvents.cpp
index b1985cbb7d053..99e3ceec08fb2 100644
--- a/lldb/tools/lldb-dap/Protocol/ProtocolEvents.cpp
+++ b/lldb/tools/lldb-dap/Protocol/ProtocolEvents.cpp
@@ -90,6 +90,9 @@ static llvm::json::Value toJSON(const StoppedReason &SR) {
   case eStoppedReasonInstructionBreakpoint:
     return "instruction breakpoint";
   }
+
+  assert(false && "invalid StopReason");
+  return "";
 }
 
 llvm::json::Value toJSON(const StoppedEventBody &SEB) {

_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to