Rewrite all Property related functions in terms of StringRef.
This was a bit tricky, especially for things like
OptionValueArray and OptionValueDictionary since they do some
funky string parsing. Rather than try to re-write line-by-line
I tried to make the StringRef usage idiomatic, even though
it meant often re-writing from scratch large blocks of code
in a different way while keeping true to the original intent.
The finished code is a big improvement though, and often much
shorter than the original code. All tests and unit tests
pass on Windows and Linux.
llvm-svn: 287242
diff --git a/lldb/source/Target/Target.cpp b/lldb/source/Target/Target.cpp
index 4344d4c..fb43c40 100644
--- a/lldb/source/Target/Target.cpp
+++ b/lldb/source/Target/Target.cpp
@@ -3694,15 +3694,15 @@
nullptr, idx, g_properties[idx].default_uint_value);
}
-const char *TargetProperties::GetArg0() const {
+llvm::StringRef TargetProperties::GetArg0() const {
const uint32_t idx = ePropertyArg0;
- return m_collection_sp->GetPropertyAtIndexAsString(nullptr, idx, nullptr);
+ return m_collection_sp->GetPropertyAtIndexAsString(nullptr, idx, llvm::StringRef());
}
-void TargetProperties::SetArg0(const char *arg) {
+void TargetProperties::SetArg0(llvm::StringRef arg) {
const uint32_t idx = ePropertyArg0;
m_collection_sp->SetPropertyAtIndexAsString(
- nullptr, idx, llvm::StringRef::withNullAsEmpty(arg));
+ nullptr, idx, arg);
m_launch_info.SetArg0(arg);
}