diff options
author | Steve Naroff <snaroff@apple.com> | 2009-02-03 20:39:18 +0000 |
---|---|---|
committer | Steve Naroff <snaroff@apple.com> | 2009-02-03 20:39:18 +0000 |
commit | 62c2632c555bc701d41f0eb1803bbf0660d7f0c0 (patch) | |
tree | 7ccc89e5bc331850367ab0cc119c5bfe63a4a9ea | |
parent | ebc07d57be9e0722b4b9c66625e1fca43dcc2ee0 (diff) |
Fix <rdar://problem/6521757> 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
-rw-r--r-- | Driver/RewriteObjC.cpp | 13 |
1 files changed, 9 insertions, 4 deletions
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); } |