diff options
| author | Reid Spencer <rspencer@reidspencer.com> | 2006-12-15 19:44:51 +0000 |
|---|---|---|
| committer | Reid Spencer <rspencer@reidspencer.com> | 2006-12-15 19:44:51 +0000 |
| commit | 1c6cb06ff573a410dfe0c256868b23ba502efbab (patch) | |
| tree | 765021524051b1348b153abf3c2ae684ec6cf6c7 /llvm/lib/Bytecode/Archive/ArchiveWriter.cpp | |
| parent | ffca910d4509f00b7d9eced6404f8c888306b4ec (diff) | |
| download | bcm5719-llvm-1c6cb06ff573a410dfe0c256868b23ba502efbab.tar.gz bcm5719-llvm-1c6cb06ff573a410dfe0c256868b23ba502efbab.zip | |
For PR1050:
Convert asserts into error messages.
llvm-svn: 32607
Diffstat (limited to 'llvm/lib/Bytecode/Archive/ArchiveWriter.cpp')
| -rw-r--r-- | llvm/lib/Bytecode/Archive/ArchiveWriter.cpp | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/llvm/lib/Bytecode/Archive/ArchiveWriter.cpp b/llvm/lib/Bytecode/Archive/ArchiveWriter.cpp index d07fe960b53..9f4e797998c 100644 --- a/llvm/lib/Bytecode/Archive/ArchiveWriter.cpp +++ b/llvm/lib/Bytecode/Archive/ArchiveWriter.cpp @@ -153,7 +153,11 @@ Archive::fillHeader(const ArchiveMember &mbr, ArchiveMemberHeader& hdr, bool Archive::addFileBefore(const sys::Path& filePath, iterator where, std::string* ErrMsg) { - assert(filePath.exists() && "Can't add a non-existent file"); + if (!filePath.exists()) { + if (ErrMsg) + *ErrMsg = "Can not add a non-existent file to archive"; + return true; + } ArchiveMember* mbr = new ArchiveMember(this); @@ -385,8 +389,11 @@ Archive::writeToDisk(bool CreateSymbolTable, bool TruncateNames, bool Compress, { // Make sure they haven't opened up the file, not loaded it, // but are now trying to write it which would wipe out the file. - assert(!(members.empty() && mapfile->size() > 8) && - "Can't write an archive not opened for writing"); + if (members.empty() && mapfile->size() > 8) { + if (ErrMsg) + *ErrMsg = "Can't write an archive not opened for writing"; + return true; + } // Create a temporary file to store the archive in sys::Path TmpArchive = archPath; |

