aboutsummaryrefslogtreecommitdiff
path: root/Basic/SourceManager.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2007-09-03 18:24:56 +0000
committerChris Lattner <sabre@nondot.org>2007-09-03 18:24:56 +0000
commit6a4545ed8b9600860126c9e332831424c4729638 (patch)
treeb942f5a63d86ef50289c11063b0b1d77ca5729f1 /Basic/SourceManager.cpp
parent0b6f0ee3a47f8607623b46f78a26049d11ecfca5 (diff)
Add #ifdefs to make the source portable to windows. Patch contributed
by Hartmut Kaiser! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41684 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'Basic/SourceManager.cpp')
-rw-r--r--Basic/SourceManager.cpp10
1 files changed, 9 insertions, 1 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;