github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code.
:warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
git-clang-format --diff origin/main HEAD --extensions h,cpp --
lldb/include/lldb/Interpreter/CommandHistoryWithContext.h
lldb/source/Interpreter/CommandHistoryWithContext.cpp
lldb/unittests/Interpreter/TestCommandHistoryWithContext.cpp
lldb/include/lldb/Interpreter/CommandInterpreter.h
lldb/source/Interpreter/CommandInterpreter.cpp --diff_from_common_commit
``````````
:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/lldb/source/Interpreter/CommandHistoryWithContext.cpp
b/lldb/source/Interpreter/CommandHistoryWithContext.cpp
index ab98cfba7..b3a16f82e 100644
--- a/lldb/source/Interpreter/CommandHistoryWithContext.cpp
+++ b/lldb/source/Interpreter/CommandHistoryWithContext.cpp
@@ -60,8 +60,7 @@ void CommandHistoryWithContext::AppendCommand(
SaveLocked();
}
-std::optional<std::string>
-CommandHistoryWithContext::FindSuggestion(
+std::optional<std::string> CommandHistoryWithContext::FindSuggestion(
llvm::StringRef line, const CommandExecutionContext ¤t) const {
std::lock_guard<std::recursive_mutex> guard(m_mutex);
@@ -104,7 +103,7 @@ CommandHistoryWithContext::FindSuggestion(
// Preference: same file/line, then same function, then same target, and
// finally fall back to the most recent command sharing the prefix.
- const Entry *chosen = by_file_line ? by_file_line
+ const Entry *chosen = by_file_line ? by_file_line
: by_function ? by_function
: by_target ? by_target
: by_prefix;
@@ -158,12 +157,12 @@ void CommandHistoryWithContext::Load() {
entry.context.file = obj->getString("file").value_or("").str();
entry.context.line =
static_cast<uint32_t>(obj->getInteger("line").value_or(0));
- entry.context.function_name =
- obj->getString("function").value_or("").str();
+ entry.context.function_name =
obj->getString("function").value_or("").str();
entry.context.working_directory = obj->getString("cwd").value_or("").str();
// Restore the invocation count, defaulting to 1 for older files or bad
// values so every retained command counts as invoked at least once.
- uint64_t count =
static_cast<uint64_t>(obj->getInteger("count").value_or(1));
+ uint64_t count =
+ static_cast<uint64_t>(obj->getInteger("count").value_or(1));
entry.invocation_count = count ? count : 1;
m_entries.push_back(std::move(entry));
}
diff --git a/lldb/source/Interpreter/CommandInterpreter.cpp
b/lldb/source/Interpreter/CommandInterpreter.cpp
index aebc7e268..a50937f7c 100644
--- a/lldb/source/Interpreter/CommandInterpreter.cpp
+++ b/lldb/source/Interpreter/CommandInterpreter.cpp
@@ -2428,15 +2428,15 @@ CommandExecutionContext
CommandInterpreter::GetCurrentCommandContext() {
// Record the basename of the target's executable.
if (Target *target = exe_ctx.GetTargetPtr()) {
if (Module *exe_module = target->GetExecutableModulePointer())
- context.target_name =
- exe_module->GetFileSpec().GetFilename().str();
+ context.target_name = exe_module->GetFileSpec().GetFilename().str();
}
// Record the current stop location: source file and line, plus the base name
// of the function we are stopped in.
if (StackFrame *frame = exe_ctx.GetFramePtr()) {
- SymbolContext sc = frame->GetSymbolContext(
- eSymbolContextFunction | eSymbolContextLineEntry |
eSymbolContextSymbol);
+ SymbolContext sc =
+ frame->GetSymbolContext(eSymbolContextFunction |
+ eSymbolContextLineEntry |
eSymbolContextSymbol);
context.function_name =
sc.GetFunctionName(Mangled::ePreferDemangledWithoutArguments)
.GetString();
diff --git a/lldb/unittests/Interpreter/TestCommandHistoryWithContext.cpp
b/lldb/unittests/Interpreter/TestCommandHistoryWithContext.cpp
index dde8b2940..5fb856875 100644
--- a/lldb/unittests/Interpreter/TestCommandHistoryWithContext.cpp
+++ b/lldb/unittests/Interpreter/TestCommandHistoryWithContext.cpp
@@ -101,7 +101,8 @@ TEST(CommandHistoryWithContextTest,
PrefersSameTargetWhenNoBetterMatch) {
std::optional<std::string>("at_a"));
}
-TEST(CommandHistoryWithContextTest,
MergesDuplicateCommandsAndRefreshesContext) {
+TEST(CommandHistoryWithContextTest,
+ MergesDuplicateCommandsAndRefreshesContext) {
CommandHistoryWithContext history((FileSpec()));
history.AppendCommand("print x", MakeContext("a.out", "a.c", 10, "foo"));
// Re-invoking the same command refreshes its context to the latest one and
@@ -160,8 +161,8 @@ TEST(CommandHistoryWithContextTest, CapsAtMaxEntries) {
TEST(CommandHistoryWithContextTest, PersistsAcrossInstances) {
llvm::SmallString<128> temp_path;
- ASSERT_FALSE(llvm::sys::fs::createTemporaryFile("lldb-history", "json",
- temp_path));
+ ASSERT_FALSE(
+ llvm::sys::fs::createTemporaryFile("lldb-history", "json", temp_path));
FileSpec history_file(temp_path);
{
``````````
</details>
https://github.com/llvm/llvm-project/pull/206939
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits