/// \brief Print the error message to the error output stream.
void error(const Twine &Message, StringRef Whence = "");
+ /// \brief Append a reference to a private copy of \p Path into SourceFiles.
+ void addCollectedPath(const std::string &Path);
+
/// \brief Return a memory buffer for the given source file.
ErrorOr<const MemoryBuffer &> getSourceFile(StringRef SourceFile);
CoverageViewOptions ViewOpts;
std::string PGOFilename;
CoverageFiltersMatchAll Filters;
- std::vector<std::string> SourceFiles;
+ std::vector<StringRef> SourceFiles;
std::vector<std::pair<std::string, std::unique_ptr<MemoryBuffer>>>
LoadedSourceFiles;
bool CompareFilenamesOnly;
StringMap<std::string> RemappedFilenames;
std::string CoverageArch;
+
+private:
+ std::vector<std::string> CollectedPaths;
};
}
errs() << Message << "\n";
}
+void CodeCoverageTool::addCollectedPath(const std::string &Path) {
+ CollectedPaths.push_back(Path);
+ SourceFiles.emplace_back(CollectedPaths.back());
+}
+
ErrorOr<const MemoryBuffer &>
CodeCoverageTool::getSourceFile(StringRef SourceFile) {
// If we've remapped filenames, look up the real location for this file.
errs() << "error: " << File << ": " << EC.message();
return 1;
}
- SourceFiles.push_back(Path.str());
+ addCollectedPath(Path.str());
}
return 0;
};
std::unique_ptr<coverage::CoverageMapping> Coverage)
: Options(Options), Coverage(std::move(Coverage)) {}
- void renderFunctionReports(ArrayRef<std::string> Files, raw_ostream &OS);
+ void renderFunctionReports(ArrayRef<StringRef> Files, raw_ostream &OS);
void renderFileReports(raw_ostream &OS);
};