Skip to content

Commit

Permalink
createUniqueFile() is documented to create the file in the temporary …
Browse files Browse the repository at this point in the history
…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
  • Loading branch information
d1r7y committed Oct 1, 2015
1 parent c50ae36 commit 3c55f2c
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion clang/lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 3c55f2c

Please sign in to comment.