summaryrefslogtreecommitdiffstats
path: root/llvm/tools/bugpoint/OptimizerDriver.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/tools/bugpoint/OptimizerDriver.cpp')
-rw-r--r--llvm/tools/bugpoint/OptimizerDriver.cpp12
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,
OpenPOWER on IntegriCloud