r215376 - unique_ptr-ify the MemoryBuffer parameter of GlobalModuleIndex
David Blaikie
dblaikie at gmail.com
Mon Aug 11 11:47:26 PDT 2014
Author: dblaikie
Date: Mon Aug 11 13:47:26 2014
New Revision: 215376
URL: http://llvm.org/viewvc/llvm-project?rev=215376&view=rev
Log:
unique_ptr-ify the MemoryBuffer parameter of GlobalModuleIndex
Modified:
cfe/trunk/include/clang/Serialization/GlobalModuleIndex.h
cfe/trunk/lib/Serialization/GlobalModuleIndex.cpp
Modified: cfe/trunk/include/clang/Serialization/GlobalModuleIndex.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Serialization/GlobalModuleIndex.h?rev=215376&r1=215375&r2=215376&view=diff
==============================================================================
--- cfe/trunk/include/clang/Serialization/GlobalModuleIndex.h (original)
+++ cfe/trunk/include/clang/Serialization/GlobalModuleIndex.h Mon Aug 11 13:47:26 2014
@@ -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<llvm::MemoryBuffer> Buffer,
llvm::BitstreamCursor Cursor);
GlobalModuleIndex(const GlobalModuleIndex &) LLVM_DELETED_FUNCTION;
Modified: cfe/trunk/lib/Serialization/GlobalModuleIndex.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/GlobalModuleIndex.cpp?rev=215376&r1=215375&r2=215376&view=diff
==============================================================================
--- cfe/trunk/lib/Serialization/GlobalModuleIndex.cpp (original)
+++ cfe/trunk/lib/Serialization/GlobalModuleIndex.cpp Mon Aug 11 13:47:26 2014
@@ -122,11 +122,10 @@ typedef llvm::OnDiskIterableChainedHashT
}
-GlobalModuleIndex::GlobalModuleIndex(llvm::MemoryBuffer *Buffer,
+GlobalModuleIndex::GlobalModuleIndex(std::unique_ptr<llvm::MemoryBuffer> 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 P
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);
}
More information about the cfe-commits
mailing list