diff options
author | Zachary Turner <zturner@google.com> | 2018-06-12 17:43:52 +0000 |
---|---|---|
committer | Zachary Turner <zturner@google.com> | 2018-06-12 17:43:52 +0000 |
commit | 08426e1f9f76f137d6958a450b1b5febed9b2ff2 (patch) | |
tree | 03d4c0c327b4cd0f00bd250af505ad1d53a0b79f /lldb/unittests/Symbol/TestDWARFCallFrameInfo.cpp | |
parent | 70a9e47f530089261061d5bb3192f43aad28250a (diff) | |
download | bcm5719-llvm-08426e1f9f76f137d6958a450b1b5febed9b2ff2.tar.gz bcm5719-llvm-08426e1f9f76f137d6958a450b1b5febed9b2ff2.zip |
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.
llvm-svn: 334518
Diffstat (limited to 'lldb/unittests/Symbol/TestDWARFCallFrameInfo.cpp')
-rw-r--r-- | lldb/unittests/Symbol/TestDWARFCallFrameInfo.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/lldb/unittests/Symbol/TestDWARFCallFrameInfo.cpp b/lldb/unittests/Symbol/TestDWARFCallFrameInfo.cpp index 85cb4a72b95..c8d560f03de 100644 --- a/lldb/unittests/Symbol/TestDWARFCallFrameInfo.cpp +++ b/lldb/unittests/Symbol/TestDWARFCallFrameInfo.cpp @@ -96,11 +96,12 @@ void DWARFCallFrameInfoTest::TestBasic(DWARFCallFrameInfo::Type type, "basic-call-frame-info-%%%%%%", "obj", obj)); llvm::FileRemover obj_remover(obj); - const char *args[] = {YAML2OBJ, yaml.c_str(), nullptr}; + llvm::StringRef args[] = {YAML2OBJ, yaml}; llvm::StringRef obj_ref = obj; const llvm::Optional<llvm::StringRef> redirects[] = {llvm::None, obj_ref, llvm::None}; - ASSERT_EQ(0, llvm::sys::ExecuteAndWait(YAML2OBJ, args, nullptr, redirects)); + ASSERT_EQ(0, + llvm::sys::ExecuteAndWait(YAML2OBJ, args, llvm::None, redirects)); uint64_t size; ASSERT_NO_ERROR(llvm::sys::fs::file_size(obj, size)); |