From d88308767b27815e48b1e478272d704ce515f833 Mon Sep 17 00:00:00 2001 From: Rafael Espindola Date: Wed, 12 Jun 2013 14:11:15 +0000 Subject: [PATCH] Remove the old file memory mapping functions. llvm-svn: 183828 --- llvm/include/llvm/Support/PathV1.h | 23 ----------------------- llvm/lib/Support/MemoryBuffer.cpp | 3 +-- llvm/lib/Support/Unix/Path.inc | 17 ----------------- llvm/lib/Support/Windows/Path.inc | 11 ----------- 4 files changed, 1 insertion(+), 53 deletions(-) diff --git a/llvm/include/llvm/Support/PathV1.h b/llvm/include/llvm/Support/PathV1.h index bc15cd3beb8d..232167a6ca55 100644 --- a/llvm/include/llvm/Support/PathV1.h +++ b/llvm/include/llvm/Support/PathV1.h @@ -495,29 +495,6 @@ namespace sys { bool eraseFromDisk(bool destroy_contents = false, std::string *Err = 0) const; - - /// MapInFilePages - This is a low level system API to map in the file - /// that is currently opened as FD into the current processes' address - /// space for read only access. This function may return null on failure - /// or if the system cannot provide the following constraints: - /// 1) The pages must be valid after the FD is closed, until - /// UnMapFilePages is called. - /// 2) Any padding after the end of the file must be zero filled, if - /// present. - /// 3) The pages must be contiguous. - /// - /// This API is not intended for general use, clients should use - /// MemoryBuffer::getFile instead. - static const char *MapInFilePages(int FD, size_t FileSize, - off_t Offset); - - /// UnMapFilePages - Free pages mapped into the current process by - /// MapInFilePages. - /// - /// This API is not intended for general use, clients should use - /// MemoryBuffer::getFile instead. - static void UnMapFilePages(const char *Base, size_t FileSize); - /// @} /// @name Data /// @{ diff --git a/llvm/lib/Support/MemoryBuffer.cpp b/llvm/lib/Support/MemoryBuffer.cpp index 7c5ab96a764a..82812c0aed61 100644 --- a/llvm/lib/Support/MemoryBuffer.cpp +++ b/llvm/lib/Support/MemoryBuffer.cpp @@ -33,8 +33,7 @@ #include #else #include -// Simplistic definitinos of these macros to allow files to be read with -// MapInFilePages. +// Simplistic definitinos of these macros for use in getOpenFile. #ifndef S_ISREG #define S_ISREG(x) (1) #endif diff --git a/llvm/lib/Support/Unix/Path.inc b/llvm/lib/Support/Unix/Path.inc index 39538d0e0616..7b236a56e118 100644 --- a/llvm/lib/Support/Unix/Path.inc +++ b/llvm/lib/Support/Unix/Path.inc @@ -773,21 +773,4 @@ Path::makeUnique(bool reuse_current, std::string* ErrMsg) { #endif return false; } - -const char *Path::MapInFilePages(int FD, size_t FileSize, off_t Offset) { - int Flags = MAP_PRIVATE; -#ifdef MAP_FILE - Flags |= MAP_FILE; -#endif - void *BasePtr = ::mmap(0, FileSize, PROT_READ, Flags, FD, Offset); - if (BasePtr == MAP_FAILED) - return 0; - return (const char*)BasePtr; -} - -void Path::UnMapFilePages(const char *BasePtr, size_t FileSize) { - const void *Addr = static_cast(BasePtr); - ::munmap(const_cast(Addr), FileSize); -} - } // end llvm namespace diff --git a/llvm/lib/Support/Windows/Path.inc b/llvm/lib/Support/Windows/Path.inc index b5a703a15199..f4a2a1b44711 100644 --- a/llvm/lib/Support/Windows/Path.inc +++ b/llvm/lib/Support/Windows/Path.inc @@ -788,16 +788,5 @@ Path::createTemporaryFileOnDisk(bool reuse_current, std::string* ErrMsg) { CloseHandle(h); return false; } - -/// MapInFilePages - Not yet implemented on win32. -const char *Path::MapInFilePages(int FD, size_t FileSize, off_t Offset) { - return 0; -} - -/// MapInFilePages - Not yet implemented on win32. -void Path::UnMapFilePages(const char *Base, size_t FileSize) { - assert(0 && "NOT IMPLEMENTED"); -} - } }