]> granicus.if.org Git - clang/commitdiff
This patch remove the Win32 XFAIL from remap-complete.c
authorFrancois Pichet <pichet2000@gmail.com>
Tue, 12 Oct 2010 01:01:43 +0000 (01:01 +0000)
committerFrancois Pichet <pichet2000@gmail.com>
Tue, 12 Oct 2010 01:01:43 +0000 (01:01 +0000)
The problem was that text files were open in text mode and Microsoft implementation of fread and write will try to do nasty line-feed conversion which make the line position no longer valid. The fix is to read and write files in binary mode.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@116286 91177308-0d34-0410-b5e6-96231b3b80d8

tools/c-index-test/c-index-test.c
tools/libclang/CIndexer.cpp

index 773c009321105e6e17f1fc675d73cbbe7385bf33..84ceab2e661e0d9b8cf6c5add72390e4e760ea94 100644 (file)
@@ -109,7 +109,7 @@ int parse_remapped_files(int argc, const char **argv, int start_arg,
     }
 
     /* Open the file that we're remapping to. */
-    to_file = fopen(semi + 1, "r");
+    to_file = fopen(semi + 1, "rb");
     if (!to_file) {
       fprintf(stderr, "error: cannot open file %s that we are remapping to\n",
               semi + 1);
index b328d5cd22b940e64900f3975642bb89e95200c1..baaeab3d0d26e0b90c409843b6cc0e7b6995ce42 100644 (file)
@@ -107,7 +107,8 @@ bool clang::RemapFiles(unsigned num_unsaved_files,
       return true;
 
     std::string ErrorInfo;
-    llvm::raw_fd_ostream OS(SavedFile.c_str(), ErrorInfo);
+    llvm::raw_fd_ostream OS(SavedFile.c_str(), ErrorInfo,
+                            llvm::raw_fd_ostream::F_Binary);
     if (!ErrorInfo.empty())
       return true;