[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 HTM

2015-09-10 Thread Cameron Esfahani via cfe-commits
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


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
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [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

2015-09-14 Thread Cameron Esfahani via cfe-commits
dirty added a comment.

Ping?


http://reviews.llvm.org/D12774



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [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

2015-09-21 Thread Cameron Esfahani via cfe-commits
dirty added a comment.

Are you suggesting I change the code to something like the following:

  if (std::error_code EC =
  llvm::sys::fs::make_absolute(Model)) {
  llvm::errs() << "warning: could not make '" << Model
   << "' absolute: " << EC.message() << '\n';
return;
  }


http://reviews.llvm.org/D12774



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [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

2015-09-22 Thread Cameron Esfahani via cfe-commits
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


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
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [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

2015-09-25 Thread Cameron Esfahani via cfe-commits
dirty added a comment.

Should I go ahead and commit this change?


http://reviews.llvm.org/D12774



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


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

2015-09-30 Thread Cameron Esfahani via cfe-commits
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


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [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

2015-09-30 Thread Cameron Esfahani via cfe-commits
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


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
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D12627: Fix a small bug in clang where generating some temporary files would have an extra period before the extension.

2015-09-03 Thread Cameron Esfahani via cfe-commits
dirty created this revision.
dirty added a reviewer: akyrtzi.
dirty added a subscriber: cfe-commits.

Fix a small bug in clang where generating some temporary files would 
have an extra period before the extension.

http://reviews.llvm.org/D12627

Files:
  lib/ARCMigrate/FileRemapper.cpp
  lib/ARCMigrate/ObjCMT.cpp
  lib/Frontend/Rewrite/FrontendActions.cpp

Index: lib/Frontend/Rewrite/FrontendActions.cpp
===
--- lib/Frontend/Rewrite/FrontendActions.cpp
+++ lib/Frontend/Rewrite/FrontendActions.cpp
@@ -78,7 +78,7 @@
   std::string RewriteFilename(const std::string &Filename, int &fd) override {
 SmallString<128> Path;
 llvm::sys::fs::createTemporaryFile(llvm::sys::path::filename(Filename),
-   llvm::sys::path::extension(Filename), 
fd,
+   
llvm::sys::path::extension(Filename).drop_front(), fd,
Path);
 return Path.str();
   }
Index: lib/ARCMigrate/ObjCMT.cpp
===
--- lib/ARCMigrate/ObjCMT.cpp
+++ lib/ARCMigrate/ObjCMT.cpp
@@ -2218,7 +2218,7 @@
   SmallString<64> TempPath;
   int FD;
   if (fs::createTemporaryFile(path::filename(FE->getName()),
-  path::extension(FE->getName()), FD,
+  path::extension(FE->getName()).drop_front(), FD,
   TempPath)) {
 reportDiag("Could not create file: " + TempPath.str(), Diag);
 return std::string();
Index: lib/ARCMigrate/FileRemapper.cpp
===
--- lib/ARCMigrate/FileRemapper.cpp
+++ lib/ARCMigrate/FileRemapper.cpp
@@ -144,7 +144,7 @@
   SmallString<64> tempPath;
   int fd;
   if (fs::createTemporaryFile(path::filename(origFE->getName()),
-  path::extension(origFE->getName()), fd,
+  
path::extension(origFE->getName()).drop_front(), fd,
   tempPath))
 return report("Could not create file: " + tempPath.str(), Diag);
 


Index: lib/Frontend/Rewrite/FrontendActions.cpp
===
--- lib/Frontend/Rewrite/FrontendActions.cpp
+++ lib/Frontend/Rewrite/FrontendActions.cpp
@@ -78,7 +78,7 @@
   std::string RewriteFilename(const std::string &Filename, int &fd) override {
 SmallString<128> Path;
 llvm::sys::fs::createTemporaryFile(llvm::sys::path::filename(Filename),
-   llvm::sys::path::extension(Filename), fd,
+   llvm::sys::path::extension(Filename).drop_front(), fd,
Path);
 return Path.str();
   }
Index: lib/ARCMigrate/ObjCMT.cpp
===
--- lib/ARCMigrate/ObjCMT.cpp
+++ lib/ARCMigrate/ObjCMT.cpp
@@ -2218,7 +2218,7 @@
   SmallString<64> TempPath;
   int FD;
   if (fs::createTemporaryFile(path::filename(FE->getName()),
-  path::extension(FE->getName()), FD,
+  path::extension(FE->getName()).drop_front(), FD,
   TempPath)) {
 reportDiag("Could not create file: " + TempPath.str(), Diag);
 return std::string();
Index: lib/ARCMigrate/FileRemapper.cpp
===
--- lib/ARCMigrate/FileRemapper.cpp
+++ lib/ARCMigrate/FileRemapper.cpp
@@ -144,7 +144,7 @@
   SmallString<64> tempPath;
   int fd;
   if (fs::createTemporaryFile(path::filename(origFE->getName()),
-  path::extension(origFE->getName()), fd,
+  path::extension(origFE->getName()).drop_front(), fd,
   tempPath))
 return report("Could not create file: " + tempPath.str(), Diag);
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits