diff options
Diffstat (limited to 'llvm/tools/llvm-cov/SourceCoverageView.cpp')
-rw-r--r-- | llvm/tools/llvm-cov/SourceCoverageView.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/llvm/tools/llvm-cov/SourceCoverageView.cpp b/llvm/tools/llvm-cov/SourceCoverageView.cpp index a4e9c43d066..08eb545a29c 100644 --- a/llvm/tools/llvm-cov/SourceCoverageView.cpp +++ b/llvm/tools/llvm-cov/SourceCoverageView.cpp @@ -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)) |