[Lldb-commits] [PATCH] D84974: Enable Launching the Debugee in VSCode Terminal

Yifan Shen via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Wed Aug 19 11:35:28 PDT 2020


aelitashen added a comment.

I tried rebase onto the commit that Walter created just for formatting but I am not sure why it didn't remove those formatting noise..



================
Comment at: lldb/tools/lldb-vscode/VSCode.cpp:410
+
+VSCode::PacketStatus VSCode::SendReverseRequest(llvm::json::Object &request,
+                                                llvm::json::Object &response) {
----------------
clayborg wrote:
> clayborg wrote:
> > clayborg wrote:
> > > add "const" to before "llvm::json::Object &request"
> > I see we are modifying "request" below, so we can't make it "const". There are two ways to fix this:
> > 1 - change it to be "llvm::json::Object request" and then use std::move() when calling SendReverseRequest. 
> > 2 - just leave as a reference and modify the original object.
> > 
> > I think I prefer option #1.
> Or we can leave this as "const" as originally suggested and add a function to VSCode:
> 
> ```
> llvm::json::Object VSCode::CreateReverseRequest(std::string command) {
>   llvm::json::Object request;
>   request.try_emplace("type", "request");
>   request.try_emplace("command", command);
>   request.try_emplace("seq", ++reverse_request_seq);
>   return request;
> }
> 
> ```
> And call that in request_runInTerminal when creating the reverse request packet. See other inline comment for details.
I eventually choose #1 cuz const keeps raising problem when calling function like try_emplace() and move() :(


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D84974/new/

https://reviews.llvm.org/D84974



More information about the lldb-commits mailing list