aboutsummaryrefslogtreecommitdiff
path: root/contrib/llvm-project/llvm/tools/llvm-cov/CodeCoverage.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/llvm-project/llvm/tools/llvm-cov/CodeCoverage.cpp')
-rw-r--r--contrib/llvm-project/llvm/tools/llvm-cov/CodeCoverage.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/contrib/llvm-project/llvm/tools/llvm-cov/CodeCoverage.cpp b/contrib/llvm-project/llvm/tools/llvm-cov/CodeCoverage.cpp
index 02c0106cbc29..5c9ff41a2d5d 100644
--- a/contrib/llvm-project/llvm/tools/llvm-cov/CodeCoverage.cpp
+++ b/contrib/llvm-project/llvm/tools/llvm-cov/CodeCoverage.cpp
@@ -784,10 +784,18 @@ int CodeCoverageTool::run(Command Cmd, int argc, const char **argv) {
// If path-equivalence was given and is a comma seperated pair then set
// PathRemapping.
- auto EquivPair = StringRef(PathRemap).split(',');
- if (!(EquivPair.first.empty() && EquivPair.second.empty()))
+ if (!PathRemap.empty()) {
+ auto EquivPair = StringRef(PathRemap).split(',');
+ if (EquivPair.first.empty() || EquivPair.second.empty()) {
+ error("invalid argument '" + PathRemap +
+ "', must be in format 'from,to'",
+ "-path-equivalence");
+ return 1;
+ }
+
PathRemapping = {std::string(EquivPair.first),
std::string(EquivPair.second)};
+ }
// If a demangler is supplied, check if it exists and register it.
if (!DemanglerOpts.empty()) {