[Lldb-commits] [lldb] [lldb] Fix GCC's `-Wreturn-type` warnings (PR #127974)

via lldb-commits lldb-commits at lists.llvm.org
Thu Feb 20 02:19:47 PST 2025


https://github.com/foxtran updated https://github.com/llvm/llvm-project/pull/127974

>From d36ed841386fbc0662d120eefca076df16bdd880 Mon Sep 17 00:00:00 2001
From: "Igor S. Gerasimov" <i.s.ger at ya.ru>
Date: Thu, 20 Feb 2025 10:04:13 +0100
Subject: [PATCH 1/2] 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..fa6953a2ee14c 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";
+  default:
+    llvm_unreachable("Unknown type kind name");
   }
 }
 
diff --git a/lldb/source/ValueObject/DILLexer.cpp b/lldb/source/ValueObject/DILLexer.cpp
index c7acfec347af4..bbb5fafdacbe5 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";
+  default:
+    llvm_unreachable("Unknown token name");
   }
 }
 

>From 59d7da74b543744c045f41f7d1dd42cd16b08805 Mon Sep 17 00:00:00 2001
From: "Igor S. Gerasimov" <i.s.ger at ya.ru>
Date: Thu, 20 Feb 2025 11:19:16 +0100
Subject: [PATCH 2/2] Follow LLVM coding standard

---
 lldb/source/DataFormatters/TypeSummary.cpp | 3 +--
 lldb/source/ValueObject/DILLexer.cpp       | 3 +--
 2 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/lldb/source/DataFormatters/TypeSummary.cpp b/lldb/source/DataFormatters/TypeSummary.cpp
index fa6953a2ee14c..18bf81aedf2cb 100644
--- a/lldb/source/DataFormatters/TypeSummary.cpp
+++ b/lldb/source/DataFormatters/TypeSummary.cpp
@@ -58,9 +58,8 @@ std::string TypeSummaryImpl::GetSummaryKindName() {
     return "c++";
   case Kind::eBytecode:
     return "bytecode";
-  default:
-    llvm_unreachable("Unknown type kind name");
   }
+  llvm_unreachable("Unknown type kind name");
 }
 
 StringSummaryFormat::StringSummaryFormat(const TypeSummaryImpl::Flags &flags,
diff --git a/lldb/source/ValueObject/DILLexer.cpp b/lldb/source/ValueObject/DILLexer.cpp
index bbb5fafdacbe5..1f013288c839b 100644
--- a/lldb/source/ValueObject/DILLexer.cpp
+++ b/lldb/source/ValueObject/DILLexer.cpp
@@ -29,9 +29,8 @@ llvm::StringRef Token::GetTokenName(Kind kind) {
     return "l_paren";
   case Kind::r_paren:
     return "r_paren";
-  default:
-    llvm_unreachable("Unknown token name");
   }
+  llvm_unreachable("Unknown token name");
 }
 
 static bool IsLetter(char c) {



More information about the lldb-commits mailing list