Eliminate some unnessary Path::exists() calls.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@104888 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Dan Gohman 2010-05-27 20:51:54 +00:00
parent 8983846e69
commit d27047f87d
4 changed files with 14 additions and 27 deletions

View File

@ -366,7 +366,6 @@ Archive::writeToDisk(bool CreateSymbolTable, bool TruncateNames, bool Compress,
// Check for errors opening or creating archive file.
if (!ArchiveFile.is_open() || ArchiveFile.bad()) {
if (TmpArchive.exists())
TmpArchive.eraseFromDisk();
if (ErrMsg)
*ErrMsg = "Error opening archive file: " + archPath.str();
@ -387,7 +386,6 @@ Archive::writeToDisk(bool CreateSymbolTable, bool TruncateNames, bool Compress,
for (MembersList::iterator I = begin(), E = end(); I != E; ++I) {
if (writeMember(*I, ArchiveFile, CreateSymbolTable,
TruncateNames, Compress, ErrMsg)) {
if (TmpArchive.exists())
TmpArchive.eraseFromDisk();
ArchiveFile.close();
return true;
@ -420,7 +418,6 @@ Archive::writeToDisk(bool CreateSymbolTable, bool TruncateNames, bool Compress,
std::ofstream FinalFile(FinalFilePath.c_str(), io_mode);
if (!FinalFile.is_open() || FinalFile.bad()) {
if (TmpArchive.exists())
TmpArchive.eraseFromDisk();
if (ErrMsg)
*ErrMsg = "Error opening archive file: " + FinalFilePath.str();
@ -438,7 +435,6 @@ Archive::writeToDisk(bool CreateSymbolTable, bool TruncateNames, bool Compress,
if (foreignST) {
if (writeMember(*foreignST, FinalFile, false, false, false, ErrMsg)) {
FinalFile.close();
if (TmpArchive.exists())
TmpArchive.eraseFromDisk();
return true;
}

View File

@ -365,7 +365,6 @@ Module *BugDriver::ExtractMappedBlocksFromModule(const
PI.push_back(getPI(createBlockExtractorPass(EmptyBBs)));
Module *Ret = runPassesOn(M, PI, false, 1, &ExtraArg);
if (uniqueFilename.exists())
uniqueFilename.eraseFromDisk(); // Free disk space
if (Ret == 0) {

View File

@ -62,7 +62,6 @@ static inline std::auto_ptr<Module> LoadFile(const char *argv0,
}
SMDiagnostic Err;
if (Filename.exists()) {
if (Verbose) errs() << "Loading '" << Filename.c_str() << "'\n";
Module* Result = 0;
@ -70,12 +69,7 @@ static inline std::auto_ptr<Module> LoadFile(const char *argv0,
Result = ParseIRFile(FNStr, Err, Context);
if (Result) return std::auto_ptr<Module>(Result); // Load successful!
if (Verbose)
Err.Print(argv0, errs());
} else {
errs() << "Bitcode file: '" << Filename.c_str() << "' does not exist.\n";
}
return std::auto_ptr<Module>();
}

View File

@ -183,7 +183,6 @@ const void* LTOCodeGenerator::compile(size_t* length, std::string& errMsg)
genResult = this->generateAssemblyCode(asmFile, errMsg);
}
if ( genResult ) {
if ( uniqueAsmPath.exists() )
uniqueAsmPath.eraseFromDisk();
return NULL;
}
@ -191,7 +190,6 @@ const void* LTOCodeGenerator::compile(size_t* length, std::string& errMsg)
// make unique temp .o file to put generated object file
sys::PathWithStatus uniqueObjPath("lto-llvm.o");
if ( uniqueObjPath.createTemporaryFileOnDisk(true, &errMsg) ) {
if ( uniqueAsmPath.exists() )
uniqueAsmPath.eraseFromDisk();
return NULL;
}