diff --git a/lib/Format/Format.cpp b/lib/Format/Format.cpp
index ffe41c224ae266755195b9ef4ca4f0ced7d58920..61c904cc7fe618645709a7f487cb2b68ab6db28c 100644
--- a/lib/Format/Format.cpp
+++ b/lib/Format/Format.cpp
@@ -1917,7 +1917,11 @@ FormatStyle getStyle(StringRef StyleName, StringRef FileName,
   // Look for .clang-format/_clang-format file in the file's parent directories.
   SmallString<128> UnsuitableConfigFiles;
   SmallString<128> Path(FileName);
-  llvm::sys::fs::make_absolute(Path);
+  if (std::error_code EC = FS->makeAbsolute(Path)) {
+    llvm::errs() << EC.message() << "\n";
+    return Style;
+  }
+
   for (StringRef Directory = Path; !Directory.empty();
        Directory = llvm::sys::path::parent_path(Directory)) {
 
diff --git a/unittests/Format/FormatTest.cpp b/unittests/Format/FormatTest.cpp
index 75d352bc6d9141de19a301fe42e169c0656cab1c..09b85357d152e9024c68994af3d7acaa2da283bd 100644
--- a/unittests/Format/FormatTest.cpp
+++ b/unittests/Format/FormatTest.cpp
@@ -10936,10 +10936,6 @@ TEST_F(FormatTest, ArrayAsTemplateType) {
             format("auto a = unique_ptr < Foo < Bar>[10]> ;", Spaces));
 }
 
-// Since this test case uses UNIX-style file path. We disable it for MS
-// compiler.
-#if !defined(_MSC_VER) && !defined(__MINGW32__)
-
 TEST(FormatStyle, GetStyleOfFile) {
   vfs::InMemoryFileSystem FS;
   // Test 1: format file in the same directory.
@@ -10967,8 +10963,6 @@ TEST(FormatStyle, GetStyleOfFile) {
   ASSERT_EQ(Style3, getGoogleStyle());
 }
 
-#endif // _MSC_VER
-
 TEST_F(ReplacementTest, FormatCodeAfterReplacements) {
   // Column limit is 20.
   std::string Code = "Type *a =\n"