aboutsummaryrefslogtreecommitdiff
path: root/lib/Frontend/CompilerInstance.cpp
diff options
context:
space:
mode:
authorAnders Carlsson <andersca@mac.com>2011-03-06 22:25:35 +0000
committerAnders Carlsson <andersca@mac.com>2011-03-06 22:25:35 +0000
commitaf036a6c25f540a9daf51e721485ae6d0e645bd8 (patch)
tree96ebbbf41589892282ed04a41ea823df106f354e /lib/Frontend/CompilerInstance.cpp
parent2553eaf4a6b9ca9ca59383287cdfef2a5c9fca83 (diff)
Convert FileManager::FixupRelativePath over to using PathV2.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127133 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Frontend/CompilerInstance.cpp')
-rw-r--r--lib/Frontend/CompilerInstance.cpp21
1 files changed, 12 insertions, 9 deletions
diff --git a/lib/Frontend/CompilerInstance.cpp b/lib/Frontend/CompilerInstance.cpp
index fd593de560..70d6fef295 100644
--- a/lib/Frontend/CompilerInstance.cpp
+++ b/lib/Frontend/CompilerInstance.cpp
@@ -362,19 +362,22 @@ void CompilerInstance::clearOutputFiles(bool EraseFiles) {
it = OutputFiles.begin(), ie = OutputFiles.end(); it != ie; ++it) {
delete it->OS;
if (!it->TempFilename.empty()) {
- llvm::sys::Path TempPath(it->TempFilename);
- if (EraseFiles)
- TempPath.eraseFromDisk();
- else {
- std::string Error;
- llvm::sys::Path NewOutFile(it->Filename);
+ if (EraseFiles) {
+ bool existed;
+ llvm::sys::fs::remove(it->TempFilename, existed);
+ } else {
+ llvm::SmallString<128> NewOutFile(it->Filename);
+
// If '-working-directory' was passed, the output filename should be
// relative to that.
FileManager::FixupRelativePath(NewOutFile, getFileSystemOpts());
- if (TempPath.renamePathOnDisk(NewOutFile, &Error)) {
+ if (llvm::error_code ec = llvm::sys::fs::rename(it->TempFilename,
+ NewOutFile.str())) {
getDiagnostics().Report(diag::err_fe_unable_to_rename_temp)
- << it->TempFilename << it->Filename << Error;
- TempPath.eraseFromDisk();
+ << it->TempFilename << it->Filename << ec.message();
+
+ bool existed;
+ llvm::sys::fs::remove(it->TempFilename, existed);
}
}
} else if (!it->Filename.empty() && EraseFiles)