[Lldb-commits] [PATCH] D148402: [lldb] Remove use of ConstString from Args::GetShellSafeArgument
Alex Langford via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Mon Apr 17 15:18:28 PDT 2023
This revision was automatically updated to reflect the committed changes.
Closed by commit rGc8bb7c234c68: [lldb] Remove use of ConstString from Args::GetShellSafeArgument (authored by bulbazord).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D148402/new/
https://reviews.llvm.org/D148402
Files:
lldb/source/Utility/Args.cpp
Index: lldb/source/Utility/Args.cpp
===================================================================
--- lldb/source/Utility/Args.cpp
+++ lldb/source/Utility/Args.cpp
@@ -7,7 +7,6 @@
//===----------------------------------------------------------------------===//
#include "lldb/Utility/Args.h"
-#include "lldb/Utility/ConstString.h"
#include "lldb/Utility/FileSpec.h"
#include "lldb/Utility/Stream.h"
#include "lldb/Utility/StringList.h"
@@ -385,20 +384,21 @@
std::string Args::GetShellSafeArgument(const FileSpec &shell,
llvm::StringRef unsafe_arg) {
struct ShellDescriptor {
- ConstString m_basename;
+ llvm::StringRef m_basename;
llvm::StringRef m_escapables;
};
- static ShellDescriptor g_Shells[] = {{ConstString("bash"), " '\"<>()&;"},
- {ConstString("fish"), " '\"<>()&\\|;"},
- {ConstString("tcsh"), " '\"<>()&;"},
- {ConstString("zsh"), " '\"<>()&;\\|"},
- {ConstString("sh"), " '\"<>()&;"}};
+ static ShellDescriptor g_Shells[] = {{"bash", " '\"<>()&;"},
+ {"fish", " '\"<>()&\\|;"},
+ {"tcsh", " '\"<>()&;"},
+ {"zsh", " '\"<>()&;\\|"},
+ {"sh", " '\"<>()&;"}};
// safe minimal set
llvm::StringRef escapables = " '\"";
- if (auto basename = shell.GetFilename()) {
+ auto basename = shell.GetFilename().GetStringRef();
+ if (!basename.empty()) {
for (const auto &Shell : g_Shells) {
if (Shell.m_basename == basename) {
escapables = Shell.m_escapables;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D148402.514436.patch
Type: text/x-patch
Size: 1773 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20230417/5fe4d574/attachment.bin>
More information about the lldb-commits
mailing list