aboutsummaryrefslogtreecommitdiff
path: root/contrib/llvm/lib/Support/DataStream.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/llvm/lib/Support/DataStream.cpp')
-rw-r--r--contrib/llvm/lib/Support/DataStream.cpp15
1 files changed, 8 insertions, 7 deletions
diff --git a/contrib/llvm/lib/Support/DataStream.cpp b/contrib/llvm/lib/Support/DataStream.cpp
index 0bd0c6870213..32653de51943 100644
--- a/contrib/llvm/lib/Support/DataStream.cpp
+++ b/contrib/llvm/lib/Support/DataStream.cpp
@@ -14,15 +14,14 @@
//
//===----------------------------------------------------------------------===//
-#define DEBUG_TYPE "Data-stream"
#include "llvm/Support/DataStream.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/Support/FileSystem.h"
#include "llvm/Support/Program.h"
-#include "llvm/Support/system_error.h"
#include <cerrno>
#include <cstdio>
#include <string>
+#include <system_error>
#if !defined(_MSC_VER) && !defined(__MINGW32__)
#include <unistd.h>
#else
@@ -30,6 +29,8 @@
#endif
using namespace llvm;
+#define DEBUG_TYPE "Data-stream"
+
// Interface goals:
// * StreamableMemoryObject doesn't care about complexities like using
// threads/async callbacks to actually overlap download+compile
@@ -58,16 +59,16 @@ public:
virtual ~DataFileStreamer() {
close(Fd);
}
- virtual size_t GetBytes(unsigned char *buf, size_t len) LLVM_OVERRIDE {
+ size_t GetBytes(unsigned char *buf, size_t len) override {
NumStreamFetches++;
return read(Fd, buf, len);
}
- error_code OpenFile(const std::string &Filename) {
+ std::error_code OpenFile(const std::string &Filename) {
if (Filename == "-") {
Fd = 0;
sys::ChangeStdinToBinary();
- return error_code::success();
+ return std::error_code();
}
return sys::fs::openFileForRead(Filename, Fd);
@@ -80,10 +81,10 @@ namespace llvm {
DataStreamer *getDataFileStreamer(const std::string &Filename,
std::string *StrError) {
DataFileStreamer *s = new DataFileStreamer();
- if (error_code e = s->OpenFile(Filename)) {
+ if (std::error_code e = s->OpenFile(Filename)) {
*StrError = std::string("Could not open ") + Filename + ": " +
e.message() + "\n";
- return NULL;
+ return nullptr;
}
return s;
}