diff options
author | Rafael Espindola <rafael.espindola@gmail.com> | 2015-06-16 23:29:49 +0000 |
---|---|---|
committer | Rafael Espindola <rafael.espindola@gmail.com> | 2015-06-16 23:29:49 +0000 |
commit | 1aabf982bc5ff2dbdf3906267ef680a530fd3d35 (patch) | |
tree | 36fa6d6202c61f99742d535efd2df508f128df06 /llvm/lib/Support/DataStream.cpp | |
parent | 857546e7e00f150063d0e3143fbf14e5b2157c05 (diff) | |
download | bcm5719-llvm-1aabf982bc5ff2dbdf3906267ef680a530fd3d35.tar.gz bcm5719-llvm-1aabf982bc5ff2dbdf3906267ef680a530fd3d35.zip |
Use std::unique_ptr to manage the DataStreamer in bitcode parsing.
We were already deleting it, this just makes it explicit.
llvm-svn: 239867
Diffstat (limited to 'llvm/lib/Support/DataStream.cpp')
-rw-r--r-- | llvm/lib/Support/DataStream.cpp | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/llvm/lib/Support/DataStream.cpp b/llvm/lib/Support/DataStream.cpp index c24315526cf..3b10fc5eeca 100644 --- a/llvm/lib/Support/DataStream.cpp +++ b/llvm/lib/Support/DataStream.cpp @@ -16,6 +16,7 @@ #include "llvm/Support/DataStream.h" #include "llvm/ADT/Statistic.h" +#include "llvm/ADT/STLExtras.h" #include "llvm/Support/FileSystem.h" #include "llvm/Support/Program.h" #include <string> @@ -73,16 +74,13 @@ public: } -namespace llvm { -DataStreamer *getDataFileStreamer(const std::string &Filename, - std::string *StrError) { - DataFileStreamer *s = new DataFileStreamer(); +std::unique_ptr<DataStreamer> +llvm::getDataFileStreamer(const std::string &Filename, std::string *StrError) { + std::unique_ptr<DataFileStreamer> s = make_unique<DataFileStreamer>(); if (std::error_code e = s->OpenFile(Filename)) { *StrError = std::string("Could not open ") + Filename + ": " + e.message() + "\n"; return nullptr; } - return s; -} - + return std::move(s); } |