From 6ec950549b013843a5348cc4fa5684ef10a86e7e Mon Sep 17 00:00:00 2001 From: Craig Topper Date: Sun, 18 May 2014 21:55:38 +0000 Subject: [PATCH] Remove last uses of OwningPtr from llvm. As far as I can tell these method versions are not used by lldb, lld, or clang. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@209103 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/Object/Archive.h | 4 -- include/llvm/Support/FileOutputBuffer.h | 4 -- include/llvm/Support/MemoryBuffer.h | 18 --------- lib/Object/Archive.cpp | 17 -------- lib/Support/FileOutputBuffer.cpp | 11 ------ lib/Support/MemoryBuffer.cpp | 52 ------------------------- 6 files changed, 106 deletions(-) diff --git a/include/llvm/Object/Archive.h b/include/llvm/Object/Archive.h index a73b13e0503..652b6597beb 100644 --- a/include/llvm/Object/Archive.h +++ b/include/llvm/Object/Archive.h @@ -89,13 +89,9 @@ public: return StringRef(Data.data() + StartOfFile, getSize()); } - error_code getMemoryBuffer(OwningPtr &Result, - bool FullPath = false) const; error_code getMemoryBuffer(std::unique_ptr &Result, bool FullPath = false) const; - error_code getAsBinary(OwningPtr &Result, - LLVMContext *Context = nullptr) const; error_code getAsBinary(std::unique_ptr &Result, LLVMContext *Context = nullptr) const; }; diff --git a/include/llvm/Support/FileOutputBuffer.h b/include/llvm/Support/FileOutputBuffer.h index 1884a242b3e..a8a48fa3fec 100644 --- a/include/llvm/Support/FileOutputBuffer.h +++ b/include/llvm/Support/FileOutputBuffer.h @@ -14,7 +14,6 @@ #ifndef LLVM_SUPPORT_FILEOUTPUTBUFFER_H #define LLVM_SUPPORT_FILEOUTPUTBUFFER_H -#include "llvm/ADT/OwningPtr.h" #include "llvm/ADT/SmallString.h" #include "llvm/ADT/StringRef.h" #include "llvm/Support/DataTypes.h" @@ -40,9 +39,6 @@ public: /// Factory method to create an OutputBuffer object which manages a read/write /// buffer of the specified size. When committed, the buffer will be written /// to the file at the specified path. - static error_code create(StringRef FilePath, size_t Size, - OwningPtr &Result, - unsigned Flags = 0); static error_code create(StringRef FilePath, size_t Size, std::unique_ptr &Result, unsigned Flags = 0); diff --git a/include/llvm/Support/MemoryBuffer.h b/include/llvm/Support/MemoryBuffer.h index fb74ed55223..5810c47bebc 100644 --- a/include/llvm/Support/MemoryBuffer.h +++ b/include/llvm/Support/MemoryBuffer.h @@ -24,7 +24,6 @@ namespace llvm { class error_code; -template class OwningPtr; /// MemoryBuffer - This interface provides simple read-only access to a block /// of memory, and provides simple methods for reading files and standard input @@ -71,10 +70,6 @@ public: /// \param IsVolatileSize Set to true to indicate that the file size may be /// changing, e.g. when libclang tries to parse while the user is /// editing/updating the file. - static error_code getFile(Twine Filename, OwningPtr &Result, - int64_t FileSize = -1, - bool RequiresNullTerminator = true, - bool IsVolatileSize = false); static error_code getFile(Twine Filename, std::unique_ptr &Result, int64_t FileSize = -1, @@ -88,10 +83,6 @@ public: /// \param IsVolatileSize Set to true to indicate that the file size may be /// changing, e.g. when libclang tries to parse while the user is /// editing/updating the file. - static error_code getOpenFileSlice(int FD, const char *Filename, - OwningPtr &Result, - uint64_t MapSize, int64_t Offset, - bool IsVolatileSize = false); static error_code getOpenFileSlice(int FD, const char *Filename, std::unique_ptr &Result, uint64_t MapSize, int64_t Offset, @@ -103,11 +94,6 @@ public: /// \param IsVolatileSize Set to true to indicate that the file size may be /// changing, e.g. when libclang tries to parse while the user is /// editing/updating the file. - static error_code getOpenFile(int FD, const char *Filename, - OwningPtr &Result, - uint64_t FileSize, - bool RequiresNullTerminator = true, - bool IsVolatileSize = false); static error_code getOpenFile(int FD, const char *Filename, std::unique_ptr &Result, uint64_t FileSize, @@ -141,16 +127,12 @@ public: /// getSTDIN - Read all of stdin into a file buffer, and return it. /// If an error occurs, this returns null and sets ec. - static error_code getSTDIN(OwningPtr &Result); static error_code getSTDIN(std::unique_ptr &Result); /// getFileOrSTDIN - Open the specified file as a MemoryBuffer, or open stdin /// if the Filename is "-". If an error occurs, this returns null and sets /// ec. - static error_code getFileOrSTDIN(StringRef Filename, - OwningPtr &Result, - int64_t FileSize = -1); static error_code getFileOrSTDIN(StringRef Filename, std::unique_ptr &Result, int64_t FileSize = -1); diff --git a/lib/Object/Archive.cpp b/lib/Object/Archive.cpp index d53704fa799..304ca475e13 100644 --- a/lib/Object/Archive.cpp +++ b/lib/Object/Archive.cpp @@ -13,7 +13,6 @@ #include "llvm/Object/Archive.h" #include "llvm/ADT/APInt.h" -#include "llvm/ADT/OwningPtr.h" #include "llvm/ADT/SmallString.h" #include "llvm/ADT/Twine.h" #include "llvm/Support/Endian.h" @@ -183,14 +182,6 @@ error_code Archive::Child::getMemoryBuffer(std::unique_ptr &Result return error_code::success(); } -error_code Archive::Child::getMemoryBuffer(OwningPtr &Result, - bool FullPath) const { - std::unique_ptr MB; - error_code ec = getMemoryBuffer(MB, FullPath); - Result = std::move(MB); - return ec; -} - error_code Archive::Child::getAsBinary(std::unique_ptr &Result, LLVMContext *Context) const { std::unique_ptr ret; @@ -204,14 +195,6 @@ error_code Archive::Child::getAsBinary(std::unique_ptr &Result, return object_error::success; } -error_code Archive::Child::getAsBinary(OwningPtr &Result, - LLVMContext *Context) const { - std::unique_ptr B; - error_code ec = getAsBinary(B, Context); - Result = std::move(B); - return ec; -} - ErrorOr Archive::create(MemoryBuffer *Source) { error_code EC; std::unique_ptr Ret(new Archive(Source, EC)); diff --git a/lib/Support/FileOutputBuffer.cpp b/lib/Support/FileOutputBuffer.cpp index 7e922df1358..49311c29d8b 100644 --- a/lib/Support/FileOutputBuffer.cpp +++ b/lib/Support/FileOutputBuffer.cpp @@ -12,7 +12,6 @@ //===----------------------------------------------------------------------===// #include "llvm/Support/FileOutputBuffer.h" -#include "llvm/ADT/OwningPtr.h" #include "llvm/ADT/SmallVector.h" #include "llvm/Support/raw_ostream.h" #include "llvm/Support/system_error.h" @@ -85,16 +84,6 @@ error_code FileOutputBuffer::create(StringRef FilePath, return error_code::success(); } -error_code FileOutputBuffer::create(StringRef FilePath, - size_t Size, - OwningPtr &Result, - unsigned Flags) { - std::unique_ptr FOB; - error_code ec = create(FilePath, Size, FOB, Flags); - Result = std::move(FOB); - return ec; -} - error_code FileOutputBuffer::commit(int64_t NewSmallerSize) { // Unmap buffer, letting OS flush dirty pages to file on disk. Region.reset(nullptr); diff --git a/lib/Support/MemoryBuffer.cpp b/lib/Support/MemoryBuffer.cpp index 26c3a2ebd26..9be05d6b7a2 100644 --- a/lib/Support/MemoryBuffer.cpp +++ b/lib/Support/MemoryBuffer.cpp @@ -12,7 +12,6 @@ //===----------------------------------------------------------------------===// #include "llvm/Support/MemoryBuffer.h" -#include "llvm/ADT/OwningPtr.h" #include "llvm/ADT/SmallString.h" #include "llvm/Config/config.h" #include "llvm/Support/Errno.h" @@ -165,15 +164,6 @@ error_code MemoryBuffer::getFileOrSTDIN(StringRef Filename, return getFile(Filename, Result, FileSize); } -error_code MemoryBuffer::getFileOrSTDIN(StringRef Filename, - OwningPtr &Result, - int64_t FileSize) { - std::unique_ptr MB; - error_code ec = getFileOrSTDIN(Filename, MB, FileSize); - Result = std::move(MB); - return ec; -} - //===----------------------------------------------------------------------===// // MemoryBuffer::getFile implementation. @@ -259,18 +249,6 @@ error_code MemoryBuffer::getFile(Twine Filename, RequiresNullTerminator, IsVolatileSize); } -error_code MemoryBuffer::getFile(Twine Filename, - OwningPtr &Result, - int64_t FileSize, - bool RequiresNullTerminator, - bool IsVolatileSize) { - std::unique_ptr MB; - error_code ec = getFile(Filename, MB, FileSize, RequiresNullTerminator, - IsVolatileSize); - Result = std::move(MB); - return ec; -} - static error_code getOpenFileImpl(int FD, const char *Filename, std::unique_ptr &Result, uint64_t FileSize, uint64_t MapSize, @@ -437,18 +415,6 @@ error_code MemoryBuffer::getOpenFile(int FD, const char *Filename, RequiresNullTerminator, IsVolatileSize); } -error_code MemoryBuffer::getOpenFile(int FD, const char *Filename, - OwningPtr &Result, - uint64_t FileSize, - bool RequiresNullTerminator, - bool IsVolatileSize) { - std::unique_ptr MB; - error_code ec = getOpenFileImpl(FD, Filename, MB, FileSize, FileSize, 0, - RequiresNullTerminator, IsVolatileSize); - Result = std::move(MB); - return ec; -} - error_code MemoryBuffer::getOpenFileSlice(int FD, const char *Filename, std::unique_ptr &Result, uint64_t MapSize, int64_t Offset, @@ -457,17 +423,6 @@ error_code MemoryBuffer::getOpenFileSlice(int FD, const char *Filename, IsVolatileSize); } -error_code MemoryBuffer::getOpenFileSlice(int FD, const char *Filename, - OwningPtr &Result, - uint64_t MapSize, int64_t Offset, - bool IsVolatileSize) { - std::unique_ptr MB; - error_code ec = getOpenFileImpl(FD, Filename, MB, -1, MapSize, Offset, false, - IsVolatileSize); - Result = std::move(MB); - return ec; -} - //===----------------------------------------------------------------------===// // MemoryBuffer::getSTDIN implementation. //===----------------------------------------------------------------------===// @@ -481,10 +436,3 @@ error_code MemoryBuffer::getSTDIN(std::unique_ptr &Result) { return getMemoryBufferForStream(0, "", Result); } - -error_code MemoryBuffer::getSTDIN(OwningPtr &Result) { - std::unique_ptr MB; - error_code ec = getSTDIN(MB); - Result = std::move(MB); - return ec; -}