[Lldb-commits] [lldb] [lldb-dap] Correct auto-completion based on ReplMode and escape char (PR #110784)
via lldb-commits
lldb-commits at lists.llvm.org
Tue Oct 1 19:45:58 PDT 2024
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 915df1ae41652e2f595ce741dcd8f01878ef4e30 41694e6e64b3f16cc5b8e4b64c89d27f4e076573 --extensions cpp,h -- lldb/tools/lldb-dap/DAP.cpp lldb/tools/lldb-dap/DAP.h lldb/tools/lldb-dap/lldb-dap.cpp
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/lldb/tools/lldb-dap/DAP.cpp b/lldb/tools/lldb-dap/DAP.cpp
index 75fe97802c..3f9929eea3 100644
--- a/lldb/tools/lldb-dap/DAP.cpp
+++ b/lldb/tools/lldb-dap/DAP.cpp
@@ -483,7 +483,8 @@ llvm::json::Value DAP::CreateTopLevelScopes() {
return llvm::json::Value(std::move(scopes));
}
-ReplMode DAP::DetectReplMode(lldb::SBFrame frame, std::string &expression, bool partial_expression) {
+ReplMode DAP::DetectReplMode(lldb::SBFrame frame, std::string &expression,
+ bool partial_expression) {
// Check for the escape hatch prefix.
if (!expression.empty() &&
llvm::StringRef(expression).starts_with(g_dap.command_escape_prefix)) {
@@ -512,7 +513,7 @@ ReplMode DAP::DetectReplMode(lldb::SBFrame frame, std::string &expression, bool
// If the first token is not fully finished yet, we can't
// determine whether this will be a variable or a lldb command.
if (partial_expression && token.second.empty()) {
- return ReplMode::Auto;
+ return ReplMode::Auto;
}
std::string term = token.first.str();
diff --git a/lldb/tools/lldb-dap/lldb-dap.cpp b/lldb/tools/lldb-dap/lldb-dap.cpp
index 93811056a7..edbbd9bc5f 100644
--- a/lldb/tools/lldb-dap/lldb-dap.cpp
+++ b/lldb/tools/lldb-dap/lldb-dap.cpp
@@ -1395,10 +1395,12 @@ void request_completions(const llvm::json::Object &request) {
}
llvm::json::Array targets;
- bool had_escape_prefix = llvm::StringRef(text).starts_with(g_dap.command_escape_prefix);
+ bool had_escape_prefix =
+ llvm::StringRef(text).starts_with(g_dap.command_escape_prefix);
ReplMode completion_mode = g_dap.DetectReplMode(frame, text, true);
- // Handle the offset change introduced by stripping out the `command_escape_prefix`.
+ // Handle the offset change introduced by stripping out the
+ // `command_escape_prefix`.
if (had_escape_prefix) {
if (offset < g_dap.command_escape_prefix.size()) {
body.try_emplace("targets", std::move(targets));
@@ -1580,10 +1582,10 @@ void request_evaluate(const llvm::json::Object &request) {
bool repeat_last_command =
expression.empty() && g_dap.last_nonempty_var_expression.empty();
- if (context == "repl" && (repeat_last_command ||
- (!expression.empty() &&
- g_dap.DetectReplMode(frame, expression, false) ==
- ReplMode::Command))) {
+ if (context == "repl" &&
+ (repeat_last_command ||
+ (!expression.empty() &&
+ g_dap.DetectReplMode(frame, expression, false) == ReplMode::Command))) {
// Since the current expression is not for a variable, clear the
// last_nonempty_var_expression field.
g_dap.last_nonempty_var_expression.clear();
``````````
</details>
https://github.com/llvm/llvm-project/pull/110784
More information about the lldb-commits
mailing list