[PATCH] D12774: 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.

Cameron Esfahani via cfe-commits cfe-commits at lists.llvm.org
Tue Sep 22 23:02:33 PDT 2015


dirty updated this revision to Diff 35463.
dirty added a comment.

- Update patch with feedback from vsk: better handle errors from make_absolute().

Updating D12774: 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.


http://reviews.llvm.org/D12774

Files:
  lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp

Index: lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp
===================================================================
--- lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp
+++ lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp
@@ -281,7 +281,12 @@
 
   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


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D12774.35463.patch
Type: text/x-patch
Size: 788 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20150923/0217a62a/attachment.bin>


More information about the cfe-commits mailing list