[Lldb-commits] [lldb] [lldb-server] Fix constexpr-if-else static assert (PR #194394)

via lldb-commits lldb-commits at lists.llvm.org
Mon Apr 27 07:57:45 PDT 2026


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-lldb

Author: Felipe de Azevedo Piovezan (felipepiovezan)

<details>
<summary>Changes</summary>

Some old compilers complained about the `static_assert(false)` pattern.

---
Full diff: https://github.com/llvm/llvm-project/pull/194394.diff


1 Files Affected:

- (modified) lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp (+5-3) 


``````````diff
diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
index b7570aea61db3..44836ae3aa61c 100644
--- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
@@ -3081,14 +3081,16 @@ GDBRemoteCommunicationServerLLGS::SendBreakpointResponse(
   return std::visit(
       [&](auto &&arg) {
         using T = std::decay_t<decltype(arg)>;
+        static_assert(std::is_same_v<T, BreakpointOK> ||
+                          std::is_same_v<T, BreakpointError> ||
+                          std::is_same_v<T, BreakpointIllFormed>,
+                      "non-exhaustive visitor!");
         if constexpr (std::is_same_v<T, BreakpointOK>)
           return SendOKResponse();
         else if constexpr (std::is_same_v<T, BreakpointError>)
           return SendErrorResponse(arg.error_code);
-        else if constexpr (std::is_same_v<T, BreakpointIllFormed>)
-          return SendIllFormedResponse(packet, arg.message.c_str());
         else
-          static_assert(false, "non-exhaustive visitor!");
+          return SendIllFormedResponse(packet, arg.message.c_str());
       },
       result);
 }

``````````

</details>


https://github.com/llvm/llvm-project/pull/194394


More information about the lldb-commits mailing list