https://github.com/foxtran created https://github.com/llvm/llvm-project/pull/127974
This patch fixes `-Wreturn-type` warnings which happens if LLVM is built with GCC compiler (14.1 is used for detecting) Warnings: ``` llvm-project/lldb/source/ValueObject/DILLexer.cpp: In static member function ‘static llvm::StringRef lldb_private::dil::Token::GetTokenName(Kind)’: llvm-project/lldb/source/ValueObject/DILLexer.cpp:33:1: warning: control reaches end of non-void function [-Wreturn-type] 33 | } | ^ ``` and: ``` llvm-project/lldb/source/DataFormatters/TypeSummary.cpp: In member function ‘virtual std::string lldb_private::TypeSummaryImpl::GetSummaryKindName()’: llvm-project/lldb/source/DataFormatters/TypeSummary.cpp:62:1: warning: control reaches end of non-void function [-Wreturn-type] 62 | } | ^ ``` Technically, it is a bug in GCC (see #115345), however, UBSan with Clang should detect these places, therefore it would be nice to provide a return statement for all possible inputs (even invalid). >From 5d5aea82763f32445ae5ef86927fff5032f29786 Mon Sep 17 00:00:00 2001 From: "Igor S. Gerasimov" <i.s....@ya.ru> Date: Thu, 20 Feb 2025 10:04:13 +0100 Subject: [PATCH] Fix GCC's -Wreturn-type warning --- lldb/source/DataFormatters/TypeSummary.cpp | 2 ++ lldb/source/ValueObject/DILLexer.cpp | 2 ++ 2 files changed, 4 insertions(+) diff --git a/lldb/source/DataFormatters/TypeSummary.cpp b/lldb/source/DataFormatters/TypeSummary.cpp index 2c863b364538f..1b73efa398d43 100644 --- a/lldb/source/DataFormatters/TypeSummary.cpp +++ b/lldb/source/DataFormatters/TypeSummary.cpp @@ -58,6 +58,8 @@ std::string TypeSummaryImpl::GetSummaryKindName() { return "c++"; case Kind::eBytecode: return "bytecode"; + case default: + return "unknown"; } } diff --git a/lldb/source/ValueObject/DILLexer.cpp b/lldb/source/ValueObject/DILLexer.cpp index c7acfec347af4..a637fc1c978c7 100644 --- a/lldb/source/ValueObject/DILLexer.cpp +++ b/lldb/source/ValueObject/DILLexer.cpp @@ -29,6 +29,8 @@ llvm::StringRef Token::GetTokenName(Kind kind) { return "l_paren"; case Kind::r_paren: return "r_paren"; + case default: + return "unknown"; } } _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits