From: Steve Naroff Date: Tue, 3 Feb 2009 20:39:18 +0000 (+0000) Subject: Fix clang ObjC rewriter: Mixed Mac and Windows line endings... X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=62c2632c555bc701d41f0eb1803bbf0660d7f0c0;p=clang Fix clang ObjC rewriter: Mixed Mac and Windows line endings after rewrite. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63657 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/Driver/RewriteObjC.cpp b/Driver/RewriteObjC.cpp index f18a0c53ce..facb195430 100644 --- a/Driver/RewriteObjC.cpp +++ b/Driver/RewriteObjC.cpp @@ -456,11 +456,10 @@ void RewriteObjC::Initialize(ASTContext &context) { 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 @@ void RewriteObjC::HandleTranslationUnit(TranslationUnit& TU) { 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 @@ void RewriteObjC::HandleTranslationUnit(TranslationUnit& TU) { 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); }