llvm.org GIT mirror llvm / b7e2188
Don't use PathV1.h in Signals.h. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183947 91177308-0d34-0410-b5e6-96231b3b80d8 Rafael Espindola 6 years ago
9 changed file(s) with 25 addition(s) and 23 deletion(s). Raw diff Collapse all Expand all
1515 #define LLVM_SUPPORT_SIGNALS_H
1616
1717 #include "llvm/Support/Path.h"
18 #include "llvm/Support/PathV1.h"
1918 #include
2019
2120 namespace llvm {
2827 /// This function registers signal handlers to ensure that if a signal gets
2928 /// delivered that the named file is removed.
3029 /// @brief Remove a file if a fatal signal occurs.
31 bool RemoveFileOnSignal(const Path &Filename, std::string* ErrMsg = 0);
32
33 inline bool RemoveFileOnSignal(StringRef Filename, std::string* ErrMsg = 0) {
34 return RemoveFileOnSignal(sys::Path(Filename), ErrMsg);
35 }
30 bool RemoveFileOnSignal(StringRef Filename, std::string* ErrMsg = 0);
3631
3732 /// This function removes a file from the list of files to be removed on
3833 /// signal delivery.
39 void DontRemoveFileOnSignal(const Path &Filename);
34 void DontRemoveFileOnSignal(StringRef Filename);
4035
4136 /// When an error signal (such as SIBABRT or SIGSEGV) is delivered to the
4237 /// process, print a stack trace and then exit.
365365 return true;
366366
367367 // Make sure the temporary gets removed if we crash
368 sys::RemoveFileOnSignal(TmpArchive);
368 sys::RemoveFileOnSignal(TmpArchive.str());
369369
370370 // Create archive file for output.
371371 std::ios::openmode io_mode = std::ios::out | std::ios::trunc |
426426 // mmapped data
427427 if (FinalFilePath.createTemporaryFileOnDisk(ErrMsg))
428428 return true;
429 sys::RemoveFileOnSignal(FinalFilePath);
429 sys::RemoveFileOnSignal(FinalFilePath.str());
430430
431431 std::ofstream FinalFile(FinalFilePath.c_str(), io_mode);
432432 if (!FinalFile.is_open() || FinalFile.bad()) {
2121 #include "llvm/Support/ELF.h"
2222 #include "llvm/Support/ErrorHandling.h"
2323 #include "llvm/Support/MemoryBuffer.h"
24 #include "llvm/Support/PathV1.h"
2425 #include "llvm/Support/Signals.h"
2526 #include "llvm/Support/SourceMgr.h"
2627 using namespace llvm;
1111 //===----------------------------------------------------------------------===//
1212
1313 #include "llvm/Support/ToolOutputFile.h"
14 #include "llvm/Support/PathV1.h"
1415 #include "llvm/Support/Signals.h"
1516 using namespace llvm;
1617
1819 : Filename(filename), Keep(false) {
1920 // Arrange for the file to be deleted if the process is killed.
2021 if (Filename != "-")
21 sys::RemoveFileOnSignal(sys::Path(Filename));
22 sys::RemoveFileOnSignal(Filename);
2223 }
2324
2425 tool_output_file::CleanupInstaller::~CleanupInstaller() {
2930 // Ok, the file is successfully written and closed, or deleted. There's no
3031 // further need to clean it up on signals.
3132 if (Filename != "-")
32 sys::DontRemoveFileOnSignal(sys::Path(Filename));
33 sys::DontRemoveFileOnSignal(Filename);
3334 }
3435
3536 tool_output_file::tool_output_file(const char *filename, std::string &ErrorInfo,
210210 }
211211
212212 // RemoveFileOnSignal - The public API
213 bool llvm::sys::RemoveFileOnSignal(const sys::Path &Filename,
213 bool llvm::sys::RemoveFileOnSignal(StringRef Filename,
214214 std::string* ErrMsg) {
215215 SignalsMutex.acquire();
216216 std::string *OldPtr = FilesToRemove.empty() ? 0 : &FilesToRemove[0];
217 FilesToRemove.push_back(Filename.str());
217 FilesToRemove.push_back(Filename);
218218
219219 // We want to call 'c_str()' on every std::string in this vector so that if
220220 // the underlying implementation requires a re-allocation, it happens here
234234 }
235235
236236 // DontRemoveFileOnSignal - The public API
237 void llvm::sys::DontRemoveFileOnSignal(const sys::Path &Filename) {
237 void llvm::sys::DontRemoveFileOnSignal(StringRef Filename) {
238238 SignalsMutex.acquire();
239239 std::vector::reverse_iterator RI =
240 std::find(FilesToRemove.rbegin(), FilesToRemove.rend(), Filename.str());
240 std::find(FilesToRemove.rbegin(), FilesToRemove.rend(), Filename);
241241 std::vector::iterator I = FilesToRemove.end();
242242 if (RI != FilesToRemove.rend())
243243 I = FilesToRemove.erase(RI.base()-1);
99 // This file provides the Win32 specific implementation of the Signals class.
1010 //
1111 //===----------------------------------------------------------------------===//
12
13 #include "llvm/Support/PathV1.h"
1214
1315 #include "Windows.h"
1416 #include
157159 // InterruptFunction - The function to call if ctrl-c is pressed.
158160 static void (*InterruptFunction)() = 0;
159161
160 static std::vector<llvm::sys::Path> *FilesToRemove = NULL;
162 static std::vector<std::string> *FilesToRemove = NULL;
161163 static std::vector > *CallBacksToRun = 0;
162164 static bool RegisteredUnhandledExceptionFilter = false;
163165 static bool CleanupExecuted = false;
275277 }
276278
277279 // RemoveFileOnSignal - The public API
278 bool sys::RemoveFileOnSignal(const sys::Path &Filename, std::string* ErrMsg) {
280 bool sys::RemoveFileOnSignal(StringRef Filename, std::string* ErrMsg) {
279281 RegisterHandler();
280282
281283 if (CleanupExecuted) {
285287 }
286288
287289 if (FilesToRemove == NULL)
288 FilesToRemove = new std::vectorys::Path>;
290 FilesToRemove = new std::vectortd::string>;
289291
290292 FilesToRemove->push_back(Filename);
291293
294296 }
295297
296298 // DontRemoveFileOnSignal - The public API
297 void sys::DontRemoveFileOnSignal(const sys::Path &Filename) {
299 void sys::DontRemoveFileOnSignal(StringRef Filename) {
298300 if (FilesToRemove == NULL)
299301 return;
300302
301303 RegisterHandler();
302304
303305 FilesToRemove->push_back(Filename);
304 std::vectorys::Path>::reverse_iterator I =
306 std::vectortd::string>::reverse_iterator I =
305307 std::find(FilesToRemove->rbegin(), FilesToRemove->rend(), Filename);
306308 if (I != FilesToRemove->rend())
307309 FilesToRemove->erase(I.base()-1);
351353
352354 if (FilesToRemove != NULL)
353355 while (!FilesToRemove->empty()) {
354 FilesToRemove->back().eraseFromDisk();
356 sys::Path(FilesToRemove->back()).eraseFromDisk();
355357 FilesToRemove->pop_back();
356358 }
357359
2525 #include "llvm/Support/Debug.h"
2626 #include "llvm/Support/FileUtilities.h"
2727 #include "llvm/Support/Path.h"
28 #include "llvm/Support/PathV1.h"
2829 #include "llvm/Support/Signals.h"
2930 #include "llvm/Support/ToolOutputFile.h"
3031 #include "llvm/Transforms/IPO.h"
370371 EmitProgressBitcode(M, "basicblockextractfail", true);
371372 return 0;
372373 }
373 sys::RemoveFileOnSignal(uniqueFilename);
374 sys::RemoveFileOnSignal(uniqueFilename.str());
374375
375376 std::string ErrorInfo;
376377 tool_output_file BlocksToNotExtractFile(uniqueFilename.c_str(), ErrorInfo);
2020 #include "llvm/Support/CommandLine.h"
2121 #include "llvm/Support/ManagedStatic.h"
2222 #include "llvm/Support/Path.h"
23 #include "llvm/Support/PathV1.h"
2324 #include "llvm/Support/PrettyStackTrace.h"
2425 #include "llvm/Support/Signals.h"
2526 #include "llvm/Support/SourceMgr.h"
3232 #include "llvm/Support/FormattedStream.h"
3333 #include "llvm/Support/Host.h"
3434 #include "llvm/Support/MemoryBuffer.h"
35 #include "llvm/Support/PathV1.h"
3536 #include "llvm/Support/Signals.h"
3637 #include "llvm/Support/TargetRegistry.h"
3738 #include "llvm/Support/TargetSelect.h"
163164 uniqueObjPath.eraseFromDisk();
164165 return true;
165166 }
166 sys::RemoveFileOnSignal(uniqueObjPath);
167 sys::RemoveFileOnSignal(uniqueObjPath.str());
167168
168169 // generate object file
169170 bool genResult = false;