mirror of
https://github.com/intel/llvm.git
synced 2026-01-26 03:56:16 +08:00
[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).
This commit is contained in:
@@ -59,6 +59,7 @@ std::string TypeSummaryImpl::GetSummaryKindName() {
|
||||
case Kind::eBytecode:
|
||||
return "bytecode";
|
||||
}
|
||||
llvm_unreachable("Unknown type kind name");
|
||||
}
|
||||
|
||||
StringSummaryFormat::StringSummaryFormat(const TypeSummaryImpl::Flags &flags,
|
||||
|
||||
Reference in New Issue
Block a user