diff options
author | Alexander Kornienko <alexfh@google.com> | 2017-09-13 17:03:37 +0000 |
---|---|---|
committer | Alexander Kornienko <alexfh@google.com> | 2017-09-13 17:03:37 +0000 |
commit | 208eecd57fd7f2b2072f70f8fe81f1f5dd68267a (patch) | |
tree | 54617190d336acb1f3cc7764bb91d9b785abfd25 /llvm/tools/bugpoint/OptimizerDriver.cpp | |
parent | f6c74c472d00467e9007dfffb26278ec053957aa (diff) | |
download | bcm5719-llvm-208eecd57fd7f2b2072f70f8fe81f1f5dd68267a.tar.gz bcm5719-llvm-208eecd57fd7f2b2072f70f8fe81f1f5dd68267a.zip |
Convenience/safety fix for llvm::sys::Execute(And|No)Wait
Summary:
Change the type of the Redirects parameter of llvm::sys::ExecuteAndWait,
ExecuteNoWait and other APIs that wrap them from `const StringRef **` to
`ArrayRef<Optional<StringRef>>`, which is safer and simplifies the use of these
APIs (no more local StringRef variables just to get a pointer to).
Corresponding clang changes will be posted as a separate patch.
Reviewers: bkramer
Reviewed By: bkramer
Subscribers: vsk, llvm-commits
Differential Revision: https://reviews.llvm.org/D37563
llvm-svn: 313155
Diffstat (limited to 'llvm/tools/bugpoint/OptimizerDriver.cpp')
-rw-r--r-- | llvm/tools/bugpoint/OptimizerDriver.cpp | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/llvm/tools/bugpoint/OptimizerDriver.cpp b/llvm/tools/bugpoint/OptimizerDriver.cpp index 489e50b8810..0b22f1b729a 100644 --- a/llvm/tools/bugpoint/OptimizerDriver.cpp +++ b/llvm/tools/bugpoint/OptimizerDriver.cpp @@ -230,13 +230,15 @@ bool BugDriver::runPasses(Module *Program, << " " << Args[i]; errs() << "\n";); - // Redirect stdout and stderr to nowhere if SilencePasses is given - StringRef Nowhere; - const StringRef *Redirects[3] = {nullptr, &Nowhere, &Nowhere}; + Optional<StringRef> Redirects[3] = {None, None, None}; + // Redirect stdout and stderr to nowhere if SilencePasses is given. + if (SilencePasses) { + Redirects[1] = ""; + Redirects[2] = ""; + } std::string ErrMsg; - int result = sys::ExecuteAndWait(Prog, Args.data(), nullptr, - (SilencePasses ? Redirects : nullptr), + int result = sys::ExecuteAndWait(Prog, Args.data(), nullptr, Redirects, Timeout, MemoryLimit, &ErrMsg); // If we are supposed to delete the bitcode file or if the passes crashed, |