Convert many functions to use StringRefs.
Where possible, remove the const char* version. To keep the
risk and impact here minimal, I've only done the simplest
functions.
In the process, I found a few opportunities for adding some
unit tests, so I added those as well.
Tested on Windows, Linux, and OSX.
llvm-svn: 281799
diff --git a/lldb/source/Interpreter/OptionGroupPlatform.cpp b/lldb/source/Interpreter/OptionGroupPlatform.cpp
index 4b3eeea..776bac7 100644
--- a/lldb/source/Interpreter/OptionGroupPlatform.cpp
+++ b/lldb/source/Interpreter/OptionGroupPlatform.cpp
@@ -105,6 +105,7 @@
++option_idx;
const int short_option = g_option_table[option_idx].short_option;
+ llvm::StringRef option_strref(option_arg ? option_arg : "");
switch (short_option) {
case 'p':
@@ -112,9 +113,8 @@
break;
case 'v':
- if (Args::StringToVersion(option_arg, m_os_version_major,
- m_os_version_minor,
- m_os_version_update) == option_arg)
+ if (!Args::StringToVersion(option_strref, m_os_version_major,
+ m_os_version_minor, m_os_version_update))
error.SetErrorStringWithFormat("invalid version string '%s'", option_arg);
break;