From ae2aa2d21b24a912314e618d1ceb8e036449b0b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Storsj=C3=B6?= Date: Wed, 6 Apr 2022 14:09:22 +0300 Subject: [PATCH] [lldb] Silence GCC warnings about missing returns after fully covered switches. NFC. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This silences warnings like this: lldb/source/Core/DebuggerEvents.cpp: In member function ‘llvm::StringRef lldb_private::DiagnosticEventData::GetPrefix() const’: lldb/source/Core/DebuggerEvents.cpp:55:1: warning: control reaches end of non-void function [-Wreturn-type] 55 | } Differential Revision: https://reviews.llvm.org/D123203 --- lldb/source/Breakpoint/Breakpoint.cpp | 1 + lldb/source/Core/DebuggerEvents.cpp | 1 + lldb/source/Plugins/Process/Linux/IntelPTCollector.cpp | 1 + 3 files changed, 3 insertions(+) diff --git a/lldb/source/Breakpoint/Breakpoint.cpp b/lldb/source/Breakpoint/Breakpoint.cpp index afadf81e32c8..578cf14283d9 100644 --- a/lldb/source/Breakpoint/Breakpoint.cpp +++ b/lldb/source/Breakpoint/Breakpoint.cpp @@ -1026,6 +1026,7 @@ const char *Breakpoint::BreakpointEventTypeAsCString(BreakpointEventType type) { case eBreakpointEventTypeThreadChanged: return "thread changed"; case eBreakpointEventTypeAutoContinueChanged: return "autocontinue changed"; }; + llvm_unreachable("Fully covered switch above!"); } Log *Breakpoint::BreakpointEventData::GetLogChannel() { diff --git a/lldb/source/Core/DebuggerEvents.cpp b/lldb/source/Core/DebuggerEvents.cpp index a433ec31738f..fdf55f68ce8e 100644 --- a/lldb/source/Core/DebuggerEvents.cpp +++ b/lldb/source/Core/DebuggerEvents.cpp @@ -52,6 +52,7 @@ llvm::StringRef DiagnosticEventData::GetPrefix() const { case Type::Error: return "error"; } + llvm_unreachable("Fully covered switch above!"); } void DiagnosticEventData::Dump(Stream *s) const { diff --git a/lldb/source/Plugins/Process/Linux/IntelPTCollector.cpp b/lldb/source/Plugins/Process/Linux/IntelPTCollector.cpp index 4882ab64f16a..8c1082862797 100644 --- a/lldb/source/Plugins/Process/Linux/IntelPTCollector.cpp +++ b/lldb/source/Plugins/Process/Linux/IntelPTCollector.cpp @@ -102,6 +102,7 @@ static Expected ReadIntelPTConfigFile(const char *file, case BitOffset: return 10; } + llvm_unreachable("Fully covered switch above!"); }; auto createError = [&](const char *expected_value_message) {