aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Basic/SourceManager.cpp10
-rw-r--r--Driver/PrintPreprocessedOutput.cpp4
2 files changed, 12 insertions, 2 deletions
diff --git a/Basic/SourceManager.cpp b/Basic/SourceManager.cpp
index 96da763451..569c864dde 100644
--- a/Basic/SourceManager.cpp
+++ b/Basic/SourceManager.cpp
@@ -41,8 +41,12 @@ SourceManager::~SourceManager() {
// FIXME: REMOVE THESE
#include <unistd.h>
#include <sys/types.h>
+#if !defined(_MSC_VER)
#include <sys/uio.h>
#include <sys/fcntl.h>
+#else
+#include <io.h>
+#endif
#include <cerrno>
static const MemoryBuffer *ReadFileFast(const FileEntry *FileEnt) {
@@ -61,8 +65,12 @@ static const MemoryBuffer *ReadFileFast(const FileEntry *FileEnt) {
MemoryBuffer *SB = MemoryBuffer::getNewUninitMemBuffer(FileEnt->getSize(),
FileEnt->getName());
char *BufPtr = const_cast<char*>(SB->getBufferStart());
-
+
+#if defined(_WIN32) || defined(_WIN64)
+ int FD = ::open(FileEnt->getName(), O_RDONLY|O_BINARY);
+#else
int FD = ::open(FileEnt->getName(), O_RDONLY);
+#endif
if (FD == -1) {
delete SB;
return 0;
diff --git a/Driver/PrintPreprocessedOutput.cpp b/Driver/PrintPreprocessedOutput.cpp
index 3eb11b719c..1cfadb35aa 100644
--- a/Driver/PrintPreprocessedOutput.cpp
+++ b/Driver/PrintPreprocessedOutput.cpp
@@ -73,7 +73,9 @@ static void CleanupOutputBuffer() {
}
static void OutputChar(char c) {
-#ifdef USE_STDIO
+#if defined(_MSC_VER)
+ putchar(c);
+#elif defined(USE_STDIO)
putchar_unlocked(c);
#else
if (OutBufCur >= OutBufEnd)