From ecbb0bb1690cd59da0224d7b906f968356b1265c Mon Sep 17 00:00:00 2001 From: Zachary Turner Date: Mon, 19 Sep 2016 17:54:06 +0000 Subject: Fix more functions in Args to use StringRef. This patch also marks the const char* versions as =delete to prevent their use. This has the potential to cause build breakages on some platforms which I can't compile. I have tested on Windows, Linux, and OSX. Best practices for fixing broken callsites are outlined in Args.h in a comment above the deleted function declarations. Eventually we can remove these =delete declarations, but for now they are important to make sure that all implicit conversions from const char * are manually audited to make sure that they do not invoke a conversion from nullptr. llvm-svn: 281919 --- lldb/source/Commands/CommandObjectProcess.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'lldb/source/Commands/CommandObjectProcess.cpp') diff --git a/lldb/source/Commands/CommandObjectProcess.cpp b/lldb/source/Commands/CommandObjectProcess.cpp index 77305fcef..26e7602 100644 --- a/lldb/source/Commands/CommandObjectProcess.cpp +++ b/lldb/source/Commands/CommandObjectProcess.cpp @@ -212,7 +212,7 @@ protected: if (target_settings_argv0) { m_options.launch_info.GetArguments().AppendArgument( - target_settings_argv0); + llvm::StringRef(target_settings_argv0)); m_options.launch_info.SetExecutableFile( exe_module_sp->GetPlatformFileSpec(), false); } else { @@ -760,12 +760,13 @@ public: ExecutionContext *execution_context) override { Error error; const int short_option = m_getopt_table[option_idx].val; + auto option_strref = llvm::StringRef::withNullAsEmpty(option_arg); switch (short_option) { case 's': bool tmp_result; bool success; - tmp_result = Args::StringToBoolean(option_arg, false, &success); + tmp_result = Args::StringToBoolean(option_strref, false, &success); if (!success) error.SetErrorStringWithFormat("invalid boolean option: \"%s\"", option_arg); @@ -1458,7 +1459,7 @@ public: bool VerifyCommandOptionValue(const std::string &option, int &real_value) { bool okay = true; bool success = false; - bool tmp_value = Args::StringToBoolean(option.c_str(), false, &success); + bool tmp_value = Args::StringToBoolean(option, false, &success); if (success && tmp_value) real_value = 1; -- cgit v1.1