summaryrefslogtreecommitdiff
path: root/lldb/source/Utility/Args.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/source/Utility/Args.cpp')
-rw-r--r--lldb/source/Utility/Args.cpp31
1 files changed, 24 insertions, 7 deletions
diff --git a/lldb/source/Utility/Args.cpp b/lldb/source/Utility/Args.cpp
index 9fcc833ce432..f718c6f9ff1c 100644
--- a/lldb/source/Utility/Args.cpp
+++ b/lldb/source/Utility/Args.cpp
@@ -1,4 +1,4 @@
-//===-- Args.cpp ------------------------------------------------*- C++ -*-===//
+//===-- Args.cpp ----------------------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
@@ -44,7 +44,7 @@ static llvm::StringRef ParseDoubleQuotes(llvm::StringRef quoted,
break;
}
- // If the character after the backslash is not a whitelisted escapable
+ // If the character after the backslash is not an allowed escapable
// character, we leave the character sequence untouched.
if (strchr(k_escapable_characters, quoted.front()) == nullptr)
result += '\\';
@@ -111,7 +111,7 @@ ParseSingleArgument(llvm::StringRef command) {
break;
}
- // If the character after the backslash is not a whitelisted escapable
+ // If the character after the backslash is not an allowed escapable
// character, we leave the character sequence untouched.
if (strchr(" \t\\'\"`", command.front()) == nullptr)
arg += '\\';
@@ -546,7 +546,7 @@ void Args::ExpandEscapedCharacters(const char *src, std::string &dst) {
dst.clear();
if (src) {
for (const char *p = src; *p != '\0'; ++p) {
- if (isprint(*p))
+ if (llvm::isPrint(*p))
dst.append(1, *p);
else {
switch (*p) {
@@ -635,7 +635,7 @@ void OptionsWithRaw::SetFromString(llvm::StringRef arg_string) {
// If the string doesn't start with a dash, we just have no options and just
// a raw part.
if (!arg_string.startswith("-")) {
- m_suffix = original_args;
+ m_suffix = std::string(original_args);
return;
}
@@ -655,7 +655,7 @@ void OptionsWithRaw::SetFromString(llvm::StringRef arg_string) {
// The remaining line is the raw suffix, and the line we parsed so far
// needs to be interpreted as arguments.
m_has_args = true;
- m_suffix = arg_string;
+ m_suffix = std::string(arg_string);
found_suffix = true;
// The length of the prefix after parsing.
@@ -681,6 +681,23 @@ void OptionsWithRaw::SetFromString(llvm::StringRef arg_string) {
// If we didn't find a suffix delimiter, the whole string is the raw suffix.
if (!found_suffix) {
found_suffix = true;
- m_suffix = original_args;
+ m_suffix = std::string(original_args);
}
}
+
+void llvm::yaml::MappingTraits<Args::ArgEntry>::mapping(IO &io,
+ Args::ArgEntry &v) {
+ MappingNormalization<NormalizedArgEntry, Args::ArgEntry> keys(io, v);
+ io.mapRequired("value", keys->value);
+ io.mapRequired("quote", keys->quote);
+}
+
+void llvm::yaml::MappingTraits<Args>::mapping(IO &io, Args &v) {
+ io.mapRequired("entries", v.m_entries);
+
+ // Recompute m_argv vector.
+ v.m_argv.clear();
+ for (auto &entry : v.m_entries)
+ v.m_argv.push_back(entry.data());
+ v.m_argv.push_back(nullptr);
+}