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
This commit is contained in:
Zachary Turner
2016-09-19 17:54:06 +00:00
parent 495b211a6c
commit ecbb0bb169
34 changed files with 194 additions and 151 deletions

View File

@@ -344,13 +344,13 @@ bool ProcessLaunchInfo::ConvertArgumentsForLaunchingInShell(
return false;
Args shell_arguments;
std::string safe_arg;
shell_arguments.AppendArgument(shell_executable.c_str());
shell_arguments.AppendArgument(shell_executable);
const llvm::Triple &triple = GetArchitecture().GetTriple();
if (triple.getOS() == llvm::Triple::Win32 &&
!triple.isWindowsCygwinEnvironment())
shell_arguments.AppendArgument("/C");
shell_arguments.AppendArgument(llvm::StringRef("/C"));
else
shell_arguments.AppendArgument("-c");
shell_arguments.AppendArgument(llvm::StringRef("-c"));
StreamString shell_command;
if (will_debug) {
@@ -428,7 +428,7 @@ bool ProcessLaunchInfo::ConvertArgumentsForLaunchingInShell(
shell_command.Printf(" %s", arg);
}
}
shell_arguments.AppendArgument(shell_command.GetString().c_str());
shell_arguments.AppendArgument(shell_command.GetString());
m_executable = m_shell;
m_arguments = shell_arguments;
return true;