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

Cameron Esfahani via cfe-commits cfe-commits at lists.llvm.org
Wed Sep 30 18:25:00 PDT 2015


Author: dirty
Date: Wed Sep 30 20:24:59 2015
New Revision: 248977

URL: http://llvm.org/viewvc/llvm-project?rev=248977&view=rev
Log:
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

Modified:
    cfe/trunk/lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp

Modified: cfe/trunk/lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp?rev=248977&r1=248976&r2=248977&view=diff
==============================================================================
--- cfe/trunk/lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp Wed Sep 30 20:24:59 2015
@@ -281,7 +281,12 @@ void HTMLDiagnostics::ReportDiag(const P
 
   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




More information about the cfe-commits mailing list