[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
Wed Sep 30 18:26:45 PDT 2015


This revision was automatically updated to reflect the committed changes.
Closed by commit rL248977: createUniqueFile() is documented to create the file in the temporary… (authored by dirty).

Changed prior to commit:
  http://reviews.llvm.org/D12774?vs=35463&id=36172#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D12774

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

Index: cfe/trunk/lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp
===================================================================
--- cfe/trunk/lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp
+++ cfe/trunk/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.36172.patch
Type: text/x-patch
Size: 818 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20151001/0c016c70/attachment.bin>


More information about the cfe-commits mailing list