Changes in directory llvm/lib/Bytecode/Archive:
Archive.cpp updated: 1.12 -> 1.13 ArchiveWriter.cpp updated: 1.25 -> 1.26 --- Log message: For PR797: http://llvm.org/PR797 : Adjust to new interface for MappedFile. Note that the new "throw" statements will be removed later. --- Diffs of the changes: (+19 -6) Archive.cpp | 8 ++++++-- ArchiveWriter.cpp | 17 +++++++++++++---- 2 files changed, 19 insertions(+), 6 deletions(-) Index: llvm/lib/Bytecode/Archive/Archive.cpp diff -u llvm/lib/Bytecode/Archive/Archive.cpp:1.12 llvm/lib/Bytecode/Archive/Archive.cpp:1.13 --- llvm/lib/Bytecode/Archive/Archive.cpp:1.12 Fri Jul 28 17:03:44 2006 +++ llvm/lib/Bytecode/Archive/Archive.cpp Tue Aug 22 11:07:44 2006 @@ -137,8 +137,12 @@ symTabSize(0), firstFileOffset(0), modules(), foreignST(0) { if (map) { - mapfile = new sys::MappedFile(filename); - base = (char*) mapfile->map(); + std::string ErrMsg; + mapfile = new sys::MappedFile(); + if (mapfile->open(filename, sys::MappedFile::READ_ACCESS, &ErrMsg)) + throw ErrMsg; + if (!(base = (char*) mapfile->map(&ErrMsg))) + throw ErrMsg; } } Index: llvm/lib/Bytecode/Archive/ArchiveWriter.cpp diff -u llvm/lib/Bytecode/Archive/ArchiveWriter.cpp:1.25 llvm/lib/Bytecode/Archive/ArchiveWriter.cpp:1.26 --- llvm/lib/Bytecode/Archive/ArchiveWriter.cpp:1.25 Fri Jul 28 17:29:50 2006 +++ llvm/lib/Bytecode/Archive/ArchiveWriter.cpp Tue Aug 22 11:07:44 2006 @@ -205,8 +205,12 @@ const char* data = (const char*)member.getData(); sys::MappedFile* mFile = 0; if (!data) { - mFile = new sys::MappedFile(member.getPath()); - data = (const char*) mFile->map(); + std::string ErrMsg; + mFile = new sys::MappedFile(); + if (mFile->open(member.getPath(), sys::MappedFile::READ_ACCESS, &ErrMsg)) + throw ErrMsg; + if (data = (const char*) mFile->map(&ErrMsg)) + throw ErrMsg; fSize = mFile->size(); } @@ -437,8 +441,13 @@ // we just wrote back in and copying it to the destination file. // Map in the archive we just wrote. - sys::MappedFile arch(TmpArchive); - const char* base = (const char*) arch.map(); + sys::MappedFile arch; + std::string ErrMsg; + if (arch.open(TmpArchive, sys::MappedFile::READ_ACCESS, &ErrMsg)) + throw ErrMsg; + const char* base; + if (!(base = (const char*) arch.map(&ErrMsg))) + throw ErrMsg; // Open another temporary file in order to avoid invalidating the // mmapped data _______________________________________________ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits