OSDN Git Service

Refactor ExecuteAndWait to take StringRefs.
authorZachary Turner <zturner@google.com>
Tue, 12 Jun 2018 17:43:52 +0000 (17:43 +0000)
committerZachary Turner <zturner@google.com>
Tue, 12 Jun 2018 17:43:52 +0000 (17:43 +0000)
commit0dcc1159b40e8d45d5d02baeb11d19a3e4339c57
treef53f3124cb097a02a22ef931526fffd9c499ae7f
parent2307d55eeeac3ae5ed5e06dd86896c5946deb307
Refactor ExecuteAndWait to take StringRefs.

This simplifies some code which had StringRefs to begin with, and
makes other code more complicated which had const char* to begin
with.

In the end, I think this makes for a more idiomatic and platform
agnostic API.  Not all platforms launch process with null terminated
c-string arrays for the environment pointer and argv, but the api
was designed that way because it allowed easy pass-through for
posix-based platforms.  There's a little additional overhead now
since on posix based platforms we'll be takign StringRefs which
were constructed from null terminated strings and then copying
them to null terminate them again, but from a readability and
usability standpoint of the API user, I think this API signature
is strictly better.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@334518 91177308-0d34-0410-b5e6-96231b3b80d8
14 files changed:
include/llvm/ADT/StringExtras.h
include/llvm/Support/Program.h
lib/Support/GraphWriter.cpp
lib/Support/Program.cpp
lib/Support/Signals.cpp
lib/Support/Unix/Program.inc
lib/Support/Windows/Program.inc
tools/bugpoint/OptimizerDriver.cpp
tools/bugpoint/ToolRunner.cpp
tools/dsymutil/MachOUtils.cpp
tools/llvm-cov/CodeCoverage.cpp
unittests/Support/Host.cpp
unittests/Support/ProgramTest.cpp
utils/not/not.cpp