[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
Thu Sep 10 14:09:35 PDT 2015


dirty created this revision.
dirty added reviewers: rsmith, akyrtzi.
dirty added a subscriber: cfe-commits.

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,8 @@
 
   if (!AnalyzerOpts.shouldWriteStableReportFilename()) {
       llvm::sys::path::append(Model, Directory, "report-%%%%%%.html");
-
+      if (llvm::sys::fs::make_absolute(Model))
+        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.34488.patch
Type: text/x-patch
Size: 613 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20150910/f572ea36/attachment.bin>


More information about the cfe-commits mailing list