[cfe-commits] r63657 - /cfe/trunk/Driver/RewriteObjC.cpp

Steve Naroff snaroff at apple.com
Tue Feb 3 12:39:18 PST 2009


Author: snaroff
Date: Tue Feb  3 14:39:18 2009
New Revision: 63657

URL: http://llvm.org/viewvc/llvm-project?rev=63657&view=rev
Log:
Fix <rdar://problem/6521757> clang ObjC rewriter: Mixed Mac and Windows line endings after rewrite.

Modified:
    cfe/trunk/Driver/RewriteObjC.cpp

Modified: cfe/trunk/Driver/RewriteObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Driver/RewriteObjC.cpp?rev=63657&r1=63656&r2=63657&view=diff

==============================================================================
--- cfe/trunk/Driver/RewriteObjC.cpp (original)
+++ cfe/trunk/Driver/RewriteObjC.cpp Tue Feb  3 14:39:18 2009
@@ -456,11 +456,10 @@
      
   Rewrite.setSourceMgr(Context->getSourceManager());
   
-  Preamble = "#line 2\n";
   // declaring objc_selector outside the parameter list removes a silly
   // scope related warning...
   if (IsHeader)
-    Preamble += "#pragma once\n";
+    Preamble = "#pragma once\n";
   Preamble += "struct objc_selector; struct objc_class;\n";
   Preamble += "struct __rw_objc_super { struct objc_object *object; ";
   Preamble += "struct objc_object *superClass; ";
@@ -4494,7 +4493,10 @@
     OutFile = &llvm::outs();
   } else if (!OutFileName.empty()) {
     std::string Err;
-    OutFile = new llvm::raw_fd_ostream(OutFileName.c_str(), false, Err);
+    OutFile = new llvm::raw_fd_ostream(OutFileName.c_str(), 
+                                       // set binary mode (critical for Windoze)
+                                       true, 
+                                       Err);
     OwnedStream.reset(OutFile);
   } else if (InFileName == "-") {
     OutFile = &llvm::outs();
@@ -4503,7 +4505,10 @@
     Path.eraseSuffix();
     Path.appendSuffix("cpp");
     std::string Err;
-    OutFile = new llvm::raw_fd_ostream(Path.toString().c_str(), false, Err);
+    OutFile = new llvm::raw_fd_ostream(Path.toString().c_str(), 
+                                       // set binary mode (critical for Windoze)
+                                       true, 
+                                       Err);
     OwnedStream.reset(OutFile);
   }
   





More information about the cfe-commits mailing list