[Lldb-commits] [lldb] ae2aa2d - [lldb] Silence GCC warnings about missing returns after fully covered switches. NFC.
Martin Storsjö via lldb-commits
lldb-commits at lists.llvm.org
Wed Apr 6 12:50:36 PDT 2022
Author: Martin Storsjö
Date: 2022-04-06T22:50:07+03:00
New Revision: ae2aa2d21b24a912314e618d1ceb8e036449b0b1
URL: https://github.com/llvm/llvm-project/commit/ae2aa2d21b24a912314e618d1ceb8e036449b0b1
DIFF: https://github.com/llvm/llvm-project/commit/ae2aa2d21b24a912314e618d1ceb8e036449b0b1.diff
LOG: [lldb] Silence GCC warnings about missing returns after fully covered switches. NFC.
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
Added:
Modified:
lldb/source/Breakpoint/Breakpoint.cpp
lldb/source/Core/DebuggerEvents.cpp
lldb/source/Plugins/Process/Linux/IntelPTCollector.cpp
Removed:
################################################################################
diff --git a/lldb/source/Breakpoint/Breakpoint.cpp b/lldb/source/Breakpoint/Breakpoint.cpp
index afadf81e32c8c..578cf14283d92 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 a433ec31738f4..fdf55f68ce8e7 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 4882ab64f16ac..8c10828627971 100644
--- a/lldb/source/Plugins/Process/Linux/IntelPTCollector.cpp
+++ b/lldb/source/Plugins/Process/Linux/IntelPTCollector.cpp
@@ -102,6 +102,7 @@ static Expected<uint32_t> ReadIntelPTConfigFile(const char *file,
case BitOffset:
return 10;
}
+ llvm_unreachable("Fully covered switch above!");
};
auto createError = [&](const char *expected_value_message) {
More information about the lldb-commits
mailing list