diff --git a/include/clang/Index/IndexDataStore.h b/include/clang/Index/IndexDataStore.h
index 714ccddc8c..0158e13a76 100644
--- a/include/clang/Index/IndexDataStore.h
+++ b/include/clang/Index/IndexDataStore.h
@@ -18,6 +18,7 @@
 #include <memory>
 #include <string>
 #include <vector>
+#include <time.h>
 
 namespace clang {
 namespace index {
diff --git a/lib/CodeGen/TargetInfo.cpp b/lib/CodeGen/TargetInfo.cpp
index e8432708c8..94981f8e0c 100644
--- a/lib/CodeGen/TargetInfo.cpp
+++ b/lib/CodeGen/TargetInfo.cpp
@@ -2154,7 +2154,7 @@ public:
   }
 
   bool isSwiftErrorInRegister() const override {
-    return true;
+    return false;
   }
 
 private:
diff --git a/lib/Driver/ToolChains.cpp b/lib/Driver/ToolChains.cpp
index a11c817794..da6a987d66 100644
--- a/lib/Driver/ToolChains.cpp
+++ b/lib/Driver/ToolChains.cpp
@@ -37,7 +37,9 @@
 #include "llvm/Support/raw_ostream.h"
 #include <cstdlib> // ::getenv
 #include <system_error>
+#if !defined(_MSC_VER)
 #include <sys/utsname.h>
+#endif
 
 using namespace clang::driver;
 using namespace clang::driver::toolchains;
@@ -513,12 +515,16 @@ void DarwinClang::AddLinkRuntimeLibArgs(const ArgList &Args,
 
 // Clang-900 specific change that's cherry-picked from the LLVM change r307372:
 static std::string getOSVersion() {
+#if defined(_MSC_VER)
+  return "";
+#else
   struct utsname info;
 
   if (uname(&info))
     return "";
 
   return info.release;
+#endif
 }
 
 static std::string updateTripleOSVersion(std::string TargetTripleString) {
diff --git a/lib/Index/IndexUnitReader.cpp b/lib/Index/IndexUnitReader.cpp
index 12a905616f..5cd86d9f0f 100644
--- a/lib/Index/IndexUnitReader.cpp
+++ b/lib/Index/IndexUnitReader.cpp
@@ -21,7 +21,11 @@
 #include "llvm/Support/Path.h"
 #include "llvm/Support/raw_ostream.h"
 
+#if defined(_MSC_VER)
+#include <io.h>
+#else
 #include <unistd.h>
+#endif
 
 using namespace clang;
 using namespace clang::index;
