diff --git a/clang/include/clang/Serialization/GlobalModuleIndex.h b/clang/include/clang/Serialization/GlobalModuleIndex.h index 1f0d7523ec29..c7f55f23d0dc 100644 --- a/clang/include/clang/Serialization/GlobalModuleIndex.h +++ b/clang/include/clang/Serialization/GlobalModuleIndex.h @@ -115,7 +115,7 @@ class GlobalModuleIndex { unsigned NumIdentifierLookupHits; /// \brief Internal constructor. Use \c readIndex() to read an index. - explicit GlobalModuleIndex(llvm::MemoryBuffer *Buffer, + explicit GlobalModuleIndex(std::unique_ptr Buffer, llvm::BitstreamCursor Cursor); GlobalModuleIndex(const GlobalModuleIndex &) LLVM_DELETED_FUNCTION; diff --git a/clang/lib/Serialization/GlobalModuleIndex.cpp b/clang/lib/Serialization/GlobalModuleIndex.cpp index 985812232505..8a3d990b6f24 100644 --- a/clang/lib/Serialization/GlobalModuleIndex.cpp +++ b/clang/lib/Serialization/GlobalModuleIndex.cpp @@ -122,11 +122,10 @@ typedef llvm::OnDiskIterableChainedHashTable } -GlobalModuleIndex::GlobalModuleIndex(llvm::MemoryBuffer *Buffer, +GlobalModuleIndex::GlobalModuleIndex(std::unique_ptr Buffer, llvm::BitstreamCursor Cursor) - : Buffer(Buffer), IdentifierIndex(), - NumIdentifierLookups(), NumIdentifierLookupHits() -{ + : Buffer(std::move(Buffer)), IdentifierIndex(), NumIdentifierLookups(), + NumIdentifierLookupHits() { // Read the global index. bool InGlobalIndexBlock = false; bool Done = false; @@ -260,7 +259,7 @@ GlobalModuleIndex::readIndex(StringRef Path) { return std::make_pair(nullptr, EC_IOError); } - return std::make_pair(new GlobalModuleIndex(Buffer.release(), Cursor), + return std::make_pair(new GlobalModuleIndex(std::move(Buffer), Cursor), EC_None); }