[Lldb-commits] [lldb] [lldb][Target][NFC] Update error messages according to LLVM-coding style (PR #181795)
Michael Buch via lldb-commits
lldb-commits at lists.llvm.org
Tue Feb 17 02:35:51 PST 2026
https://github.com/Michael137 updated https://github.com/llvm/llvm-project/pull/181795
>From e7dfb4af96185c7349bf7ef1287f693b5c6a38a5 Mon Sep 17 00:00:00 2001
From: Michael Buch <michaelbuch12 at gmail.com>
Date: Tue, 17 Feb 2026 10:03:52 +0000
Subject: [PATCH 1/3] [lldb][Target][NFC] Update error messages according to
LLVM-coding style
The [LLVM coding style
guide](https://llvm.org/docs/CodingStandards.html#error-and-warning-messages) says:
> start the first sentence with a lowercase letter, and finish the last sentence
> without a period
This patch updates the erorr messages added in https://github.com/llvm/llvm-project/pull/179208 accordingly.
(addresses https://github.com/llvm/llvm-project/pull/179208#issuecomment-3912273053)
---
lldb/source/Target/Target.cpp | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/lldb/source/Target/Target.cpp b/lldb/source/Target/Target.cpp
index 07c3653782c6b..f1560a1e74259 100644
--- a/lldb/source/Target/Target.cpp
+++ b/lldb/source/Target/Target.cpp
@@ -5380,13 +5380,13 @@ llvm::Error
EvaluateExpressionOptions::SetBooleanLanguageOption(llvm::StringRef option_name,
bool value) {
if (option_name.empty())
- return llvm::createStringError("Can't set an option with an empty name.");
+ return llvm::createStringError("can't set an option with an empty name");
if (StructuredData::ObjectSP existing_sp =
GetLanguageOptions().GetValueForKey(option_name);
existing_sp && existing_sp->GetType() != eStructuredDataTypeBoolean)
- return llvm::createStringErrorV("Trying to override existing option '{0}' "
- "of type '{1}' with a boolean value.",
+ return llvm::createStringErrorV("trying to override existing option '{0}' "
+ "of type '{1}' with a boolean value",
option_name, existing_sp->GetType());
GetLanguageOptions().AddBooleanItem(option_name, value);
@@ -5399,12 +5399,11 @@ llvm::Expected<bool> EvaluateExpressionOptions::GetBooleanLanguageOption(
const StructuredData::Dictionary &opts = GetLanguageOptions();
if (!opts.HasKey(option_name))
- return llvm::createStringErrorV("Option '{0}' does not exist.",
- option_name);
+ return llvm::createStringErrorV("option '{0}' does not exist", option_name);
bool result;
if (!opts.GetValueForKeyAsBoolean(option_name, result))
- return llvm::createStringErrorV("Failed to get option '{0}' as boolean.",
+ return llvm::createStringErrorV("failed to get option '{0}' as boolean",
option_name);
return result;
>From e07df823da51da6faff5e121f488d2aabcb507db Mon Sep 17 00:00:00 2001
From: Michael Buch <michaelbuch12 at gmail.com>
Date: Tue, 17 Feb 2026 10:20:35 +0000
Subject: [PATCH 2/3] fixup! fix tests
---
lldb/unittests/Expression/ExpressionTest.cpp | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/lldb/unittests/Expression/ExpressionTest.cpp b/lldb/unittests/Expression/ExpressionTest.cpp
index 19647c162fa5a..6a8dd825f14a9 100644
--- a/lldb/unittests/Expression/ExpressionTest.cpp
+++ b/lldb/unittests/Expression/ExpressionTest.cpp
@@ -133,9 +133,9 @@ TEST(ExpressionTests, ExpressionOptions_Basic) {
EvaluateExpressionOptions options;
EXPECT_THAT_EXPECTED(options.GetBooleanLanguageOption("foo"),
- llvm::FailedWithMessage("Option 'foo' does not exist."));
+ llvm::FailedWithMessage("option 'foo' does not exist"));
EXPECT_THAT_EXPECTED(options.GetBooleanLanguageOption("bar"),
- llvm::FailedWithMessage("Option 'bar' does not exist."));
+ llvm::FailedWithMessage("option 'bar' does not exist"));
EXPECT_THAT_ERROR(options.SetBooleanLanguageOption("foo", true),
llvm::Succeeded());
@@ -159,10 +159,10 @@ TEST(ExpressionTests, ExpressionOptions_Basic) {
// Empty option names not allowed.
EXPECT_THAT_EXPECTED(options.GetBooleanLanguageOption(""),
- llvm::FailedWithMessage("Option '' does not exist."));
+ llvm::FailedWithMessage("option '' does not exist"));
EXPECT_THAT_ERROR(
options.SetBooleanLanguageOption("", true),
- llvm::FailedWithMessage("Can't set an option with an empty name."));
+ llvm::FailedWithMessage("Can't set an option with an empty name"));
EXPECT_THAT_EXPECTED(options.GetBooleanLanguageOption(""),
- llvm::FailedWithMessage("Option '' does not exist."));
+ llvm::FailedWithMessage("option '' does not exist"));
}
>From 4444667f8e5681ad41ce283aabfa51d941aa6080 Mon Sep 17 00:00:00 2001
From: Michael Buch <michaelbuch12 at gmail.com>
Date: Tue, 17 Feb 2026 10:35:35 +0000
Subject: [PATCH 3/3] fixup! fix another test error
---
lldb/unittests/Expression/ExpressionTest.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lldb/unittests/Expression/ExpressionTest.cpp b/lldb/unittests/Expression/ExpressionTest.cpp
index 6a8dd825f14a9..4b391340dc9f6 100644
--- a/lldb/unittests/Expression/ExpressionTest.cpp
+++ b/lldb/unittests/Expression/ExpressionTest.cpp
@@ -162,7 +162,7 @@ TEST(ExpressionTests, ExpressionOptions_Basic) {
llvm::FailedWithMessage("option '' does not exist"));
EXPECT_THAT_ERROR(
options.SetBooleanLanguageOption("", true),
- llvm::FailedWithMessage("Can't set an option with an empty name"));
+ llvm::FailedWithMessage("can't set an option with an empty name"));
EXPECT_THAT_EXPECTED(options.GetBooleanLanguageOption(""),
llvm::FailedWithMessage("option '' does not exist"));
}
More information about the lldb-commits
mailing list