mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-02-14 17:34:41 +00:00
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:
parent
8983846e69
commit
d27047f87d
@ -366,8 +366,7 @@ Archive::writeToDisk(bool CreateSymbolTable, bool TruncateNames, bool Compress,
|
|||||||
|
|
||||||
// Check for errors opening or creating archive file.
|
// Check for errors opening or creating archive file.
|
||||||
if (!ArchiveFile.is_open() || ArchiveFile.bad()) {
|
if (!ArchiveFile.is_open() || ArchiveFile.bad()) {
|
||||||
if (TmpArchive.exists())
|
TmpArchive.eraseFromDisk();
|
||||||
TmpArchive.eraseFromDisk();
|
|
||||||
if (ErrMsg)
|
if (ErrMsg)
|
||||||
*ErrMsg = "Error opening archive file: " + archPath.str();
|
*ErrMsg = "Error opening archive file: " + archPath.str();
|
||||||
return true;
|
return true;
|
||||||
@ -387,8 +386,7 @@ Archive::writeToDisk(bool CreateSymbolTable, bool TruncateNames, bool Compress,
|
|||||||
for (MembersList::iterator I = begin(), E = end(); I != E; ++I) {
|
for (MembersList::iterator I = begin(), E = end(); I != E; ++I) {
|
||||||
if (writeMember(*I, ArchiveFile, CreateSymbolTable,
|
if (writeMember(*I, ArchiveFile, CreateSymbolTable,
|
||||||
TruncateNames, Compress, ErrMsg)) {
|
TruncateNames, Compress, ErrMsg)) {
|
||||||
if (TmpArchive.exists())
|
TmpArchive.eraseFromDisk();
|
||||||
TmpArchive.eraseFromDisk();
|
|
||||||
ArchiveFile.close();
|
ArchiveFile.close();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -420,8 +418,7 @@ Archive::writeToDisk(bool CreateSymbolTable, bool TruncateNames, bool Compress,
|
|||||||
|
|
||||||
std::ofstream FinalFile(FinalFilePath.c_str(), io_mode);
|
std::ofstream FinalFile(FinalFilePath.c_str(), io_mode);
|
||||||
if (!FinalFile.is_open() || FinalFile.bad()) {
|
if (!FinalFile.is_open() || FinalFile.bad()) {
|
||||||
if (TmpArchive.exists())
|
TmpArchive.eraseFromDisk();
|
||||||
TmpArchive.eraseFromDisk();
|
|
||||||
if (ErrMsg)
|
if (ErrMsg)
|
||||||
*ErrMsg = "Error opening archive file: " + FinalFilePath.str();
|
*ErrMsg = "Error opening archive file: " + FinalFilePath.str();
|
||||||
return true;
|
return true;
|
||||||
@ -438,8 +435,7 @@ Archive::writeToDisk(bool CreateSymbolTable, bool TruncateNames, bool Compress,
|
|||||||
if (foreignST) {
|
if (foreignST) {
|
||||||
if (writeMember(*foreignST, FinalFile, false, false, false, ErrMsg)) {
|
if (writeMember(*foreignST, FinalFile, false, false, false, ErrMsg)) {
|
||||||
FinalFile.close();
|
FinalFile.close();
|
||||||
if (TmpArchive.exists())
|
TmpArchive.eraseFromDisk();
|
||||||
TmpArchive.eraseFromDisk();
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -365,8 +365,7 @@ Module *BugDriver::ExtractMappedBlocksFromModule(const
|
|||||||
PI.push_back(getPI(createBlockExtractorPass(EmptyBBs)));
|
PI.push_back(getPI(createBlockExtractorPass(EmptyBBs)));
|
||||||
Module *Ret = runPassesOn(M, PI, false, 1, &ExtraArg);
|
Module *Ret = runPassesOn(M, PI, false, 1, &ExtraArg);
|
||||||
|
|
||||||
if (uniqueFilename.exists())
|
uniqueFilename.eraseFromDisk(); // Free disk space
|
||||||
uniqueFilename.eraseFromDisk(); // Free disk space
|
|
||||||
|
|
||||||
if (Ret == 0) {
|
if (Ret == 0) {
|
||||||
outs() << "*** Basic Block extraction failed, please report a bug!\n";
|
outs() << "*** Basic Block extraction failed, please report a bug!\n";
|
||||||
|
@ -62,20 +62,14 @@ static inline std::auto_ptr<Module> LoadFile(const char *argv0,
|
|||||||
}
|
}
|
||||||
|
|
||||||
SMDiagnostic Err;
|
SMDiagnostic Err;
|
||||||
if (Filename.exists()) {
|
if (Verbose) errs() << "Loading '" << Filename.c_str() << "'\n";
|
||||||
if (Verbose) errs() << "Loading '" << Filename.c_str() << "'\n";
|
Module* Result = 0;
|
||||||
Module* Result = 0;
|
|
||||||
|
const std::string &FNStr = Filename.str();
|
||||||
const std::string &FNStr = Filename.str();
|
Result = ParseIRFile(FNStr, Err, Context);
|
||||||
Result = ParseIRFile(FNStr, Err, Context);
|
if (Result) return std::auto_ptr<Module>(Result); // Load successful!
|
||||||
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";
|
|
||||||
}
|
|
||||||
|
|
||||||
|
Err.Print(argv0, errs());
|
||||||
return std::auto_ptr<Module>();
|
return std::auto_ptr<Module>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -183,16 +183,14 @@ const void* LTOCodeGenerator::compile(size_t* length, std::string& errMsg)
|
|||||||
genResult = this->generateAssemblyCode(asmFile, errMsg);
|
genResult = this->generateAssemblyCode(asmFile, errMsg);
|
||||||
}
|
}
|
||||||
if ( genResult ) {
|
if ( genResult ) {
|
||||||
if ( uniqueAsmPath.exists() )
|
uniqueAsmPath.eraseFromDisk();
|
||||||
uniqueAsmPath.eraseFromDisk();
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
// make unique temp .o file to put generated object file
|
// make unique temp .o file to put generated object file
|
||||||
sys::PathWithStatus uniqueObjPath("lto-llvm.o");
|
sys::PathWithStatus uniqueObjPath("lto-llvm.o");
|
||||||
if ( uniqueObjPath.createTemporaryFileOnDisk(true, &errMsg) ) {
|
if ( uniqueObjPath.createTemporaryFileOnDisk(true, &errMsg) ) {
|
||||||
if ( uniqueAsmPath.exists() )
|
uniqueAsmPath.eraseFromDisk();
|
||||||
uniqueAsmPath.eraseFromDisk();
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
sys::RemoveFileOnSignal(uniqueObjPath);
|
sys::RemoveFileOnSignal(uniqueObjPath);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user