aboutsummaryrefslogtreecommitdiff
path: root/llvm/tools/llvm-cov/CodeCoverage.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/tools/llvm-cov/CodeCoverage.cpp')
-rw-r--r--llvm/tools/llvm-cov/CodeCoverage.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/llvm/tools/llvm-cov/CodeCoverage.cpp b/llvm/tools/llvm-cov/CodeCoverage.cpp
index 5f1e23f2..4444fe6 100644
--- a/llvm/tools/llvm-cov/CodeCoverage.cpp
+++ b/llvm/tools/llvm-cov/CodeCoverage.cpp
@@ -413,7 +413,8 @@ void CodeCoverageTool::remapPathNames(const CoverageMapping &Coverage) {
// Convert input files from local paths to coverage data file paths.
StringMap<std::string> InvRemappedFilenames;
for (const auto &RemappedFilename : RemappedFilenames)
- InvRemappedFilenames[RemappedFilename.getValue()] = RemappedFilename.getKey();
+ InvRemappedFilenames[RemappedFilename.getValue()] =
+ std::string(RemappedFilename.getKey());
for (std::string &Filename : SourceFiles) {
SmallString<128> NativeFilename;
@@ -510,7 +511,7 @@ void CodeCoverageTool::demangleSymbols(const CoverageMapping &Coverage) {
for (const auto &Function : Coverage.getCoveredFunctions())
// On Windows, lines in the demangler's output file end with "\r\n".
// Splitting by '\n' keeps '\r's, so cut them now.
- DC.DemangledNames[Function.Name] = Symbols[I++].rtrim();
+ DC.DemangledNames[Function.Name] = std::string(Symbols[I++].rtrim());
}
void CodeCoverageTool::writeSourceFileView(StringRef SourceFile,
@@ -688,7 +689,8 @@ int CodeCoverageTool::run(Command Cmd, int argc, const char **argv) {
// PathRemapping.
auto EquivPair = StringRef(PathRemap).split(',');
if (!(EquivPair.first.empty() && EquivPair.second.empty()))
- PathRemapping = EquivPair;
+ PathRemapping = {std::string(EquivPair.first),
+ std::string(EquivPair.second)};
// If a demangler is supplied, check if it exists and register it.
if (!DemanglerOpts.empty()) {
@@ -886,7 +888,7 @@ int CodeCoverageTool::doShow(int argc, const char **argv,
// Get the source files from the function coverage mapping.
for (StringRef Filename : Coverage->getUniqueSourceFiles()) {
if (!IgnoreFilenameFilters.matchesFilename(Filename))
- SourceFiles.push_back(Filename);
+ SourceFiles.push_back(std::string(Filename));
}
// Create an index out of the source files.