Skip to content

Commit 506deb0

Browse files
authored
[lldb] Fix GCC's -Wreturn-type warnings (#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 Clang (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).
1 parent 6e457c2 commit 506deb0

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

lldb/source/DataFormatters/TypeSummary.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ std::string TypeSummaryImpl::GetSummaryKindName() {
5959
case Kind::eBytecode:
6060
return "bytecode";
6161
}
62+
llvm_unreachable("Unknown type kind name");
6263
}
6364

6465
StringSummaryFormat::StringSummaryFormat(const TypeSummaryImpl::Flags &flags,

lldb/source/ValueObject/DILLexer.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ llvm::StringRef Token::GetTokenName(Kind kind) {
3030
case Kind::r_paren:
3131
return "r_paren";
3232
}
33+
llvm_unreachable("Unknown token name");
3334
}
3435

3536
static bool IsLetter(char c) {

0 commit comments

Comments
 (0)