createUniqueFile() is documented to create the file in the temporary directory unless it's supplied an absolute path.

Make sure the output filepath supplied to createUniqueFile() in HTMLDiagnostics::ReportDiag() is absolute.

Summary: Make sure the output filepath supplied to createUniqueFile() in HTMLDiagnostics::ReportDiag() is absolute.

Reviewers: rsmith, akyrtzi

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D12774

llvm-svn: 248977
This commit is contained in:
Cameron Esfahani 2015-10-01 01:24:59 +00:00
parent c50ae36509
commit 3c55f2cd96
1 changed files with 6 additions and 1 deletions

View File

@ -281,7 +281,12 @@ void HTMLDiagnostics::ReportDiag(const PathDiagnostic& D,
if (!AnalyzerOpts.shouldWriteStableReportFilename()) {
llvm::sys::path::append(Model, Directory, "report-%%%%%%.html");
if (std::error_code EC =
llvm::sys::fs::make_absolute(Model)) {
llvm::errs() << "warning: could not make '" << Model
<< "' absolute: " << EC.message() << '\n';
return;
}
if (std::error_code EC =
llvm::sys::fs::createUniqueFile(Model, FD, ResultPath)) {
llvm::errs() << "warning: could not create file in '" << Directory