[Lldb-commits] [lldb] [lldb-dap] Remove spurious move (NFC) (PR #140641)

Jonas Devlieghere via lldb-commits lldb-commits at lists.llvm.org
Mon May 19 15:55:03 PDT 2025


https://github.com/JDevlieghere created https://github.com/llvm/llvm-project/pull/140641

getArgumentsIfRequest is returning a local variable by value. Using std::move is not needed and may inhibit copy elision. Also fixes the braces around a single-line if.

>From 0e7412042fcf77f4d5cf65b2c4e233d0cad6f931 Mon Sep 17 00:00:00 2001
From: Jonas Devlieghere <jonas at devlieghere.com>
Date: Mon, 19 May 2025 15:53:30 -0700
Subject: [PATCH] [lldb-dap] Remove spurious move (NFC)

getArgumentsIfRequest is returning a local variable by value. Using
std::move is not needed and may inhibit copy elision. Also fixes the
braces around a single-line if.
---
 lldb/tools/lldb-dap/DAP.cpp | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/lldb/tools/lldb-dap/DAP.cpp b/lldb/tools/lldb-dap/DAP.cpp
index af7a04a215fec..3419b2c3a841b 100644
--- a/lldb/tools/lldb-dap/DAP.cpp
+++ b/lldb/tools/lldb-dap/DAP.cpp
@@ -873,11 +873,10 @@ static std::optional<T> getArgumentsIfRequest(const Message &pm,
 
   T args;
   llvm::json::Path::Root root;
-  if (!fromJSON(req->arguments, args, root)) {
+  if (!fromJSON(req->arguments, args, root))
     return std::nullopt;
-  }
 
-  return std::move(args);
+  return args;
 }
 
 llvm::Error DAP::Loop() {



More information about the lldb-commits mailing list