aboutsummaryrefslogtreecommitdiff
path: root/lib/Archive/ArchiveWriter.cpp
diff options
context:
space:
mode:
authorReid Spencer <rspencer@reidspencer.com>2006-12-15 19:44:51 +0000
committerReid Spencer <rspencer@reidspencer.com>2006-12-15 19:44:51 +0000
commitcd5561a56e1521c7dc18744dcd371d255b580fdf (patch)
tree117b16301be70b3aff3ce54cf352c3028d48cf87 /lib/Archive/ArchiveWriter.cpp
parentc2ff962bf97761a54c94d2dadb555060403d49c6 (diff)
For PR1050:
Convert asserts into error messages. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32607 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Archive/ArchiveWriter.cpp')
-rw-r--r--lib/Archive/ArchiveWriter.cpp13
1 files changed, 10 insertions, 3 deletions
diff --git a/lib/Archive/ArchiveWriter.cpp b/lib/Archive/ArchiveWriter.cpp
index d07fe960b5..9f4e797998 100644
--- a/lib/Archive/ArchiveWriter.cpp
+++ b/lib/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;