[llvm-cov] Use relative paths to file reports in -output-dir mode
This makes it possible to e.g copy a report to another filesystem. llvm-svn: 274173
This commit is contained in:
@@ -28,10 +28,14 @@ void CoveragePrinter::StreamDestructor::operator()(raw_ostream *OS) const {
|
||||
}
|
||||
|
||||
std::string CoveragePrinter::getOutputPath(StringRef Path, StringRef Extension,
|
||||
bool InToplevel) {
|
||||
bool InToplevel, bool Relative) {
|
||||
assert(Extension.size() && "The file extension may not be empty");
|
||||
|
||||
SmallString<256> FullPath(Opts.ShowOutputDirectory);
|
||||
SmallString<256> FullPath;
|
||||
|
||||
if (!Relative)
|
||||
FullPath.append(Opts.ShowOutputDirectory);
|
||||
|
||||
if (!InToplevel)
|
||||
sys::path::append(FullPath, getCoverageDir());
|
||||
|
||||
@@ -51,7 +55,7 @@ CoveragePrinter::createOutputStream(StringRef Path, StringRef Extension,
|
||||
if (!Opts.hasOutputDirectory())
|
||||
return OwnedStream(&outs());
|
||||
|
||||
std::string FullPath = getOutputPath(Path, Extension, InToplevel);
|
||||
std::string FullPath = getOutputPath(Path, Extension, InToplevel, false);
|
||||
|
||||
auto ParentDir = sys::path::parent_path(FullPath);
|
||||
if (auto E = sys::fs::create_directories(ParentDir))
|
||||
|
||||
Reference in New Issue
Block a user