[llvm] r183947 - Don't use PathV1.h in Signals.h.

Rafael Espindola rafael.espindola at gmail.com
Thu Jun 13 14:16:58 PDT 2013


Author: rafael
Date: Thu Jun 13 16:16:58 2013
New Revision: 183947

URL: http://llvm.org/viewvc/llvm-project?rev=183947&view=rev
Log:
Don't use PathV1.h in Signals.h.

Modified:
    llvm/trunk/include/llvm/Support/Signals.h
    llvm/trunk/lib/Archive/ArchiveWriter.cpp
    llvm/trunk/lib/MC/MCContext.cpp
    llvm/trunk/lib/Support/ToolOutputFile.cpp
    llvm/trunk/lib/Support/Unix/Signals.inc
    llvm/trunk/lib/Support/Windows/Signals.inc
    llvm/trunk/tools/bugpoint/ExtractFunction.cpp
    llvm/trunk/tools/llvm-link/llvm-link.cpp
    llvm/trunk/tools/lto/LTOCodeGenerator.cpp

Modified: llvm/trunk/include/llvm/Support/Signals.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/Signals.h?rev=183947&r1=183946&r2=183947&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Support/Signals.h (original)
+++ llvm/trunk/include/llvm/Support/Signals.h Thu Jun 13 16:16:58 2013
@@ -16,7 +16,6 @@
 #define LLVM_SUPPORT_SIGNALS_H
 
 #include "llvm/Support/Path.h"
-#include "llvm/Support/PathV1.h"
 #include <cstdio>
 
 namespace llvm {
@@ -29,15 +28,11 @@ namespace sys {
   /// This function registers signal handlers to ensure that if a signal gets
   /// delivered that the named file is removed.
   /// @brief Remove a file if a fatal signal occurs.
-  bool RemoveFileOnSignal(const Path &Filename, std::string* ErrMsg = 0);
-
-  inline bool RemoveFileOnSignal(StringRef Filename, std::string* ErrMsg = 0) {
-    return RemoveFileOnSignal(sys::Path(Filename), ErrMsg);
-  }
+  bool RemoveFileOnSignal(StringRef Filename, std::string* ErrMsg = 0);
 
   /// This function removes a file from the list of files to be removed on
   /// signal delivery.
-  void DontRemoveFileOnSignal(const Path &Filename);
+  void DontRemoveFileOnSignal(StringRef Filename);
 
   /// When an error signal (such as SIBABRT or SIGSEGV) is delivered to the
   /// process, print a stack trace and then exit.

Modified: llvm/trunk/lib/Archive/ArchiveWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Archive/ArchiveWriter.cpp?rev=183947&r1=183946&r2=183947&view=diff
==============================================================================
--- llvm/trunk/lib/Archive/ArchiveWriter.cpp (original)
+++ llvm/trunk/lib/Archive/ArchiveWriter.cpp Thu Jun 13 16:16:58 2013
@@ -366,7 +366,7 @@ Archive::writeToDisk(bool CreateSymbolTa
     return true;
 
   // Make sure the temporary gets removed if we crash
-  sys::RemoveFileOnSignal(TmpArchive);
+  sys::RemoveFileOnSignal(TmpArchive.str());
 
   // Create archive file for output.
   std::ios::openmode io_mode = std::ios::out | std::ios::trunc |
@@ -427,7 +427,7 @@ Archive::writeToDisk(bool CreateSymbolTa
     // mmapped data
     if (FinalFilePath.createTemporaryFileOnDisk(ErrMsg))
       return true;
-    sys::RemoveFileOnSignal(FinalFilePath);
+    sys::RemoveFileOnSignal(FinalFilePath.str());
 
     std::ofstream FinalFile(FinalFilePath.c_str(), io_mode);
     if (!FinalFile.is_open() || FinalFile.bad()) {

Modified: llvm/trunk/lib/MC/MCContext.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCContext.cpp?rev=183947&r1=183946&r2=183947&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCContext.cpp (original)
+++ llvm/trunk/lib/MC/MCContext.cpp Thu Jun 13 16:16:58 2013
@@ -22,6 +22,7 @@
 #include "llvm/Support/ELF.h"
 #include "llvm/Support/ErrorHandling.h"
 #include "llvm/Support/MemoryBuffer.h"
+#include "llvm/Support/PathV1.h"
 #include "llvm/Support/Signals.h"
 #include "llvm/Support/SourceMgr.h"
 using namespace llvm;

Modified: llvm/trunk/lib/Support/ToolOutputFile.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/ToolOutputFile.cpp?rev=183947&r1=183946&r2=183947&view=diff
==============================================================================
--- llvm/trunk/lib/Support/ToolOutputFile.cpp (original)
+++ llvm/trunk/lib/Support/ToolOutputFile.cpp Thu Jun 13 16:16:58 2013
@@ -12,6 +12,7 @@
 //===----------------------------------------------------------------------===//
 
 #include "llvm/Support/ToolOutputFile.h"
+#include "llvm/Support/PathV1.h"
 #include "llvm/Support/Signals.h"
 using namespace llvm;
 
@@ -19,7 +20,7 @@ tool_output_file::CleanupInstaller::Clea
   : Filename(filename), Keep(false) {
   // Arrange for the file to be deleted if the process is killed.
   if (Filename != "-")
-    sys::RemoveFileOnSignal(sys::Path(Filename));
+    sys::RemoveFileOnSignal(Filename);
 }
 
 tool_output_file::CleanupInstaller::~CleanupInstaller() {
@@ -30,7 +31,7 @@ tool_output_file::CleanupInstaller::~Cle
   // Ok, the file is successfully written and closed, or deleted. There's no
   // further need to clean it up on signals.
   if (Filename != "-")
-    sys::DontRemoveFileOnSignal(sys::Path(Filename));
+    sys::DontRemoveFileOnSignal(Filename);
 }
 
 tool_output_file::tool_output_file(const char *filename, std::string &ErrorInfo,

Modified: llvm/trunk/lib/Support/Unix/Signals.inc
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Unix/Signals.inc?rev=183947&r1=183946&r2=183947&view=diff
==============================================================================
--- llvm/trunk/lib/Support/Unix/Signals.inc (original)
+++ llvm/trunk/lib/Support/Unix/Signals.inc Thu Jun 13 16:16:58 2013
@@ -211,11 +211,11 @@ void llvm::sys::SetInterruptFunction(voi
 }
 
 // RemoveFileOnSignal - The public API
-bool llvm::sys::RemoveFileOnSignal(const sys::Path &Filename,
+bool llvm::sys::RemoveFileOnSignal(StringRef Filename,
                                    std::string* ErrMsg) {
   SignalsMutex.acquire();
   std::string *OldPtr = FilesToRemove.empty() ? 0 : &FilesToRemove[0];
-  FilesToRemove.push_back(Filename.str());
+  FilesToRemove.push_back(Filename);
 
   // We want to call 'c_str()' on every std::string in this vector so that if
   // the underlying implementation requires a re-allocation, it happens here
@@ -235,10 +235,10 @@ bool llvm::sys::RemoveFileOnSignal(const
 }
 
 // DontRemoveFileOnSignal - The public API
-void llvm::sys::DontRemoveFileOnSignal(const sys::Path &Filename) {
+void llvm::sys::DontRemoveFileOnSignal(StringRef Filename) {
   SignalsMutex.acquire();
   std::vector<std::string>::reverse_iterator RI =
-    std::find(FilesToRemove.rbegin(), FilesToRemove.rend(), Filename.str());
+    std::find(FilesToRemove.rbegin(), FilesToRemove.rend(), Filename);
   std::vector<std::string>::iterator I = FilesToRemove.end();
   if (RI != FilesToRemove.rend())
     I = FilesToRemove.erase(RI.base()-1);

Modified: llvm/trunk/lib/Support/Windows/Signals.inc
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Windows/Signals.inc?rev=183947&r1=183946&r2=183947&view=diff
==============================================================================
--- llvm/trunk/lib/Support/Windows/Signals.inc (original)
+++ llvm/trunk/lib/Support/Windows/Signals.inc Thu Jun 13 16:16:58 2013
@@ -11,6 +11,8 @@
 //
 //===----------------------------------------------------------------------===//
 
+#include "llvm/Support/PathV1.h"
+
 #include "Windows.h"
 #include <algorithm>
 #include <stdio.h>
@@ -158,7 +160,7 @@ static BOOL WINAPI LLVMConsoleCtrlHandle
 // InterruptFunction - The function to call if ctrl-c is pressed.
 static void (*InterruptFunction)() = 0;
 
-static std::vector<llvm::sys::Path> *FilesToRemove = NULL;
+static std::vector<std::string> *FilesToRemove = NULL;
 static std::vector<std::pair<void(*)(void*), void*> > *CallBacksToRun = 0;
 static bool RegisteredUnhandledExceptionFilter = false;
 static bool CleanupExecuted = false;
@@ -276,7 +278,7 @@ static void RegisterHandler() {
 }
 
 // RemoveFileOnSignal - The public API
-bool sys::RemoveFileOnSignal(const sys::Path &Filename, std::string* ErrMsg) {
+bool sys::RemoveFileOnSignal(StringRef Filename, std::string* ErrMsg) {
   RegisterHandler();
 
   if (CleanupExecuted) {
@@ -286,7 +288,7 @@ bool sys::RemoveFileOnSignal(const sys::
   }
 
   if (FilesToRemove == NULL)
-    FilesToRemove = new std::vector<sys::Path>;
+    FilesToRemove = new std::vector<std::string>;
 
   FilesToRemove->push_back(Filename);
 
@@ -295,14 +297,14 @@ bool sys::RemoveFileOnSignal(const sys::
 }
 
 // DontRemoveFileOnSignal - The public API
-void sys::DontRemoveFileOnSignal(const sys::Path &Filename) {
+void sys::DontRemoveFileOnSignal(StringRef Filename) {
   if (FilesToRemove == NULL)
     return;
 
   RegisterHandler();
 
   FilesToRemove->push_back(Filename);
-  std::vector<sys::Path>::reverse_iterator I =
+  std::vector<std::string>::reverse_iterator I =
   std::find(FilesToRemove->rbegin(), FilesToRemove->rend(), Filename);
   if (I != FilesToRemove->rend())
     FilesToRemove->erase(I.base()-1);
@@ -352,7 +354,7 @@ static void Cleanup() {
 
   if (FilesToRemove != NULL)
     while (!FilesToRemove->empty()) {
-      FilesToRemove->back().eraseFromDisk();
+      sys::Path(FilesToRemove->back()).eraseFromDisk();
       FilesToRemove->pop_back();
     }
 

Modified: llvm/trunk/tools/bugpoint/ExtractFunction.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/bugpoint/ExtractFunction.cpp?rev=183947&r1=183946&r2=183947&view=diff
==============================================================================
--- llvm/trunk/tools/bugpoint/ExtractFunction.cpp (original)
+++ llvm/trunk/tools/bugpoint/ExtractFunction.cpp Thu Jun 13 16:16:58 2013
@@ -26,6 +26,7 @@
 #include "llvm/Support/Debug.h"
 #include "llvm/Support/FileUtilities.h"
 #include "llvm/Support/Path.h"
+#include "llvm/Support/PathV1.h"
 #include "llvm/Support/Signals.h"
 #include "llvm/Support/ToolOutputFile.h"
 #include "llvm/Transforms/IPO.h"
@@ -371,7 +372,7 @@ Module *BugDriver::ExtractMappedBlocksFr
     EmitProgressBitcode(M, "basicblockextractfail", true);
     return 0;
   }
-  sys::RemoveFileOnSignal(uniqueFilename);
+  sys::RemoveFileOnSignal(uniqueFilename.str());
 
   std::string ErrorInfo;
   tool_output_file BlocksToNotExtractFile(uniqueFilename.c_str(), ErrorInfo);

Modified: llvm/trunk/tools/llvm-link/llvm-link.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-link/llvm-link.cpp?rev=183947&r1=183946&r2=183947&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-link/llvm-link.cpp (original)
+++ llvm/trunk/tools/llvm-link/llvm-link.cpp Thu Jun 13 16:16:58 2013
@@ -21,6 +21,7 @@
 #include "llvm/Support/CommandLine.h"
 #include "llvm/Support/ManagedStatic.h"
 #include "llvm/Support/Path.h"
+#include "llvm/Support/PathV1.h"
 #include "llvm/Support/PrettyStackTrace.h"
 #include "llvm/Support/Signals.h"
 #include "llvm/Support/SourceMgr.h"

Modified: llvm/trunk/tools/lto/LTOCodeGenerator.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/lto/LTOCodeGenerator.cpp?rev=183947&r1=183946&r2=183947&view=diff
==============================================================================
--- llvm/trunk/tools/lto/LTOCodeGenerator.cpp (original)
+++ llvm/trunk/tools/lto/LTOCodeGenerator.cpp Thu Jun 13 16:16:58 2013
@@ -33,6 +33,7 @@
 #include "llvm/Support/FormattedStream.h"
 #include "llvm/Support/Host.h"
 #include "llvm/Support/MemoryBuffer.h"
+#include "llvm/Support/PathV1.h"
 #include "llvm/Support/Signals.h"
 #include "llvm/Support/TargetRegistry.h"
 #include "llvm/Support/TargetSelect.h"
@@ -164,7 +165,7 @@ bool LTOCodeGenerator::compile_to_file(c
     uniqueObjPath.eraseFromDisk();
     return true;
   }
-  sys::RemoveFileOnSignal(uniqueObjPath);
+  sys::RemoveFileOnSignal(uniqueObjPath.str());
 
   // generate object file
   bool genResult = false;





More information about the llvm-commits mailing list