summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2014-08-17 22:12:58 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2014-08-17 22:12:58 +0000
commit04ab21d75d043940f432d770b0e8891f1edefaae (patch)
tree7d6371da6a64a3bb148837f2781b2b082d6fa32d /clang/lib
parentf7aed8017ad5c91a71e4e443ffc04379c2fefedb (diff)
downloadbcm5719-llvm-04ab21d75d043940f432d770b0e8891f1edefaae.tar.gz
bcm5719-llvm-04ab21d75d043940f432d770b0e8891f1edefaae.zip
Convert a few ownership comments with std::unique_ptr.
llvm-svn: 215853
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/Basic/VirtualFileSystem.cpp15
-rw-r--r--clang/lib/Frontend/CompilerInvocation.cpp2
2 files changed, 8 insertions, 9 deletions
diff --git a/clang/lib/Basic/VirtualFileSystem.cpp b/clang/lib/Basic/VirtualFileSystem.cpp
index a5c83b88af5..60c3052bddf 100644
--- a/clang/lib/Basic/VirtualFileSystem.cpp
+++ b/clang/lib/Basic/VirtualFileSystem.cpp
@@ -514,9 +514,7 @@ public:
/// \brief Parses \p Buffer, which is expected to be in YAML format and
/// returns a virtual file system representing its contents.
- ///
- /// Takes ownership of \p Buffer.
- static VFSFromYAML *create(MemoryBuffer *Buffer,
+ static VFSFromYAML *create(std::unique_ptr<MemoryBuffer> Buffer,
SourceMgr::DiagHandlerTy DiagHandler,
void *DiagContext,
IntrusiveRefCntPtr<FileSystem> ExternalFS);
@@ -865,13 +863,13 @@ DirectoryEntry::~DirectoryEntry() { llvm::DeleteContainerPointers(Contents); }
VFSFromYAML::~VFSFromYAML() { llvm::DeleteContainerPointers(Roots); }
-VFSFromYAML *VFSFromYAML::create(MemoryBuffer *Buffer,
+VFSFromYAML *VFSFromYAML::create(std::unique_ptr<MemoryBuffer> Buffer,
SourceMgr::DiagHandlerTy DiagHandler,
void *DiagContext,
IntrusiveRefCntPtr<FileSystem> ExternalFS) {
SourceMgr SM;
- yaml::Stream Stream(Buffer, SM);
+ yaml::Stream Stream(Buffer.release(), SM);
SM.setDiagHandler(DiagHandler, DiagContext);
yaml::document_iterator DI = Stream.begin();
@@ -993,10 +991,11 @@ VFSFromYAML::openFileForRead(const Twine &Path,
}
IntrusiveRefCntPtr<FileSystem>
-vfs::getVFSFromYAML(MemoryBuffer *Buffer, SourceMgr::DiagHandlerTy DiagHandler,
- void *DiagContext,
+vfs::getVFSFromYAML(std::unique_ptr<MemoryBuffer> Buffer,
+ SourceMgr::DiagHandlerTy DiagHandler, void *DiagContext,
IntrusiveRefCntPtr<FileSystem> ExternalFS) {
- return VFSFromYAML::create(Buffer, DiagHandler, DiagContext, ExternalFS);
+ return VFSFromYAML::create(std::move(Buffer), DiagHandler, DiagContext,
+ ExternalFS);
}
UniqueID vfs::getNextVirtualUniqueID() {
diff --git a/clang/lib/Frontend/CompilerInvocation.cpp b/clang/lib/Frontend/CompilerInvocation.cpp
index 070b00c63af..fbfad94ec3c 100644
--- a/clang/lib/Frontend/CompilerInvocation.cpp
+++ b/clang/lib/Frontend/CompilerInvocation.cpp
@@ -2034,7 +2034,7 @@ createVFSFromCompilerInvocation(const CompilerInvocation &CI,
}
IntrusiveRefCntPtr<vfs::FileSystem> FS =
- vfs::getVFSFromYAML(Buffer->release(), /*DiagHandler*/ nullptr);
+ vfs::getVFSFromYAML(std::move(Buffer.get()), /*DiagHandler*/ nullptr);
if (!FS.get()) {
Diags.Report(diag::err_invalid_vfs_overlay) << File;
return IntrusiveRefCntPtr<vfs::FileSystem>();
OpenPOWER on IntegriCloud