aboutsummaryrefslogtreecommitdiff
path: root/tools/llvm-cov/CodeCoverage.cpp
diff options
context:
space:
mode:
authorAlexander Kornienko <alexfh@google.com>2017-09-13 17:03:37 +0000
committerAlexander Kornienko <alexfh@google.com>2017-09-13 17:03:37 +0000
commit87e117df596739e50867b307d591861da8ace36e (patch)
treea492fdbca5c75f75f9ada4062e4e9f12424c8380 /tools/llvm-cov/CodeCoverage.cpp
parentf6e4c7d70e68fe9e2e91a3926b9de394774f9cbd (diff)
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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@313155 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/llvm-cov/CodeCoverage.cpp')
-rw-r--r--tools/llvm-cov/CodeCoverage.cpp5
1 files changed, 1 insertions, 4 deletions
diff --git a/tools/llvm-cov/CodeCoverage.cpp b/tools/llvm-cov/CodeCoverage.cpp
index 5aa27e0181b..d1ad8134c92 100644
--- a/tools/llvm-cov/CodeCoverage.cpp
+++ b/tools/llvm-cov/CodeCoverage.cpp
@@ -458,10 +458,7 @@ void CodeCoverageTool::demangleSymbols(const CoverageMapping &Coverage) {
for (const std::string &Arg : ViewOpts.DemanglerOpts)
ArgsV.push_back(Arg.c_str());
ArgsV.push_back(nullptr);
- StringRef InputPathRef = InputPath.str();
- StringRef OutputPathRef = OutputPath.str();
- StringRef StderrRef;
- const StringRef *Redirects[] = {&InputPathRef, &OutputPathRef, &StderrRef};
+ Optional<StringRef> Redirects[] = {InputPath.str(), OutputPath.str(), {""}};
std::string ErrMsg;
int RC = sys::ExecuteAndWait(ViewOpts.DemanglerOpts[0], ArgsV.data(),
/*env=*/nullptr, Redirects, /*secondsToWait=*/0,