[Lldb-commits] [PATCH] D86667: [lldb/Target] Add custom interpreter option to `platform shell`

Jonas Devlieghere via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Wed Aug 26 19:44:53 PDT 2020


JDevlieghere added inline comments.


================
Comment at: lldb/source/API/SBPlatform.cpp:59
+
+    if (command_interpreter && command_interpreter[0]) {
+      full_command += command_interpreter;
----------------
Given that this pattern repeats a few times in this struct, maybe a small static helper function would be nice:

```static bool is_not_empty(cont char* c) { return c && c[0]; }```


================
Comment at: lldb/source/API/SBPlatform.cpp:64
+
+    if (shell_command && shell_command[0]) {
+      full_command += " \"";
----------------
Shouldn't we just bail out if the command is null/empty? Now it will run `shell -c`, right?


================
Comment at: lldb/source/API/SBPlatform.cpp:71
+    if (!full_command.empty()) {
+      m_command = full_command.c_str();
+    }
----------------
m_command is a `std::string`, why call `c_str()`?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D86667



More information about the lldb-commits mailing list