[lldb] Bring more diagnostics in compliance with our coding standards (#190410)
The LLVM Coding Standards [1] specify that: > [T]o match error message styles commonly produced by other tools, > start the first sentence with a lowercase letter, and finish the last > sentence without a period, if it would end in one otherwise. Historically, that hasn't been something we've enforced in LLDB, but in the past year or so I've started to pay more attention to this in code reviews. This PR brings more error messages in compliance, further increasing consistency. I also adopted `createStringErrorV` where it improved the code as a drive-by for lines I was already touching. [1] https://llvm.org/docs/CodingStandards.html#error-and-warning-messages Assisted-by: Claude Code
This commit is contained in:
1 parent
36e495dd90
commit
f866ef202c
67 files changed
+214
-232
No files matched your search
@@ -43,6 +43,7 @@
|
||||
#include "llvm/ADT/STLExtras.h"
|
||||
#include "llvm/ADT/StringRef.h"
|
||||
#include "llvm/Support/Error.h"
|
||||
#include "llvm/Support/ErrorExtras.h"
|
||||
#include "llvm/Support/FileSystem.h"
|
||||
#include "llvm/Support/FormatAdapters.h"
|
||||
|
||||
@@ -1957,14 +1958,17 @@ lldb::ValueObjectSP ScriptInterpreterPythonImpl::GetChildAtIndex(
|
||||
llvm::Expected<uint32_t> ScriptInterpreterPythonImpl::GetIndexOfChildWithName(
|
||||
const StructuredData::ObjectSP &implementor_sp, const char *child_name) {
|
||||
if (!implementor_sp)
|
||||
return llvm::createStringError("Type has no child named '%s'", child_name);
|
||||
return llvm::createStringErrorV("type has no child named '{0}'",
|
||||
child_name);
|
||||
|
||||
StructuredData::Generic *generic = implementor_sp->GetAsGeneric();
|
||||
if (!generic)
|
||||
return llvm::createStringError("Type has no child named '%s'", child_name);
|
||||
return llvm::createStringErrorV("type has no child named '{0}'",
|
||||
child_name);
|
||||
auto *implementor = static_cast<PyObject *>(generic->GetValue());
|
||||
if (!implementor)
|
||||
return llvm::createStringError("Type has no child named '%s'", child_name);
|
||||
return llvm::createStringErrorV("type has no child named '{0}'",
|
||||
child_name);
|
||||
|
||||
uint32_t ret_val = UINT32_MAX;
|
||||
|
||||
@@ -1976,7 +1980,8 @@ llvm::Expected<uint32_t> ScriptInterpreterPythonImpl::GetIndexOfChildWithName(
|
||||
}
|
||||
|
||||
if (ret_val == UINT32_MAX)
|
||||
return llvm::createStringError("Type has no child named '%s'", child_name);
|
||||
return llvm::createStringErrorV("type has no child named '{0}'",
|
||||
child_name);
|
||||
return ret_val;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user