[cfe-commits] r65061 - in /cfe/branches/Apple/objective-rewrite/tools/clang/Driver: PrintPreprocessedOutput.cpp RewriteObjC.cpp
Steve Naroff
snaroff at apple.com
Thu Feb 19 11:37:18 PST 2009
Author: snaroff
Date: Thu Feb 19 13:37:18 2009
New Revision: 65061
URL: http://llvm.org/viewvc/llvm-project?rev=65061&view=rev
Log:
Another fix for <rdar://problem/6596843> clang ObjC rewriter: Line endings still mixed in rewrite output.
This fix gets at the root of the remaining problem. Make sure the preprocessor output doesn't convert LF->CFLF.
I removed any explicit conversion in the rewriter (which wasn't correct).
Modified:
cfe/branches/Apple/objective-rewrite/tools/clang/Driver/PrintPreprocessedOutput.cpp
cfe/branches/Apple/objective-rewrite/tools/clang/Driver/RewriteObjC.cpp
Modified: cfe/branches/Apple/objective-rewrite/tools/clang/Driver/PrintPreprocessedOutput.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/objective-rewrite/tools/clang/Driver/PrintPreprocessedOutput.cpp?rev=65061&r1=65060&r2=65061&view=diff
==============================================================================
--- cfe/branches/Apple/objective-rewrite/tools/clang/Driver/PrintPreprocessedOutput.cpp (original)
+++ cfe/branches/Apple/objective-rewrite/tools/clang/Driver/PrintPreprocessedOutput.cpp Thu Feb 19 13:37:18 2009
@@ -514,7 +514,7 @@
// Open the output buffer.
std::string Err;
- llvm::raw_fd_ostream OS(OutFile.empty() ? "-" : OutFile.c_str(), false, Err);
+ llvm::raw_fd_ostream OS(OutFile.empty() ? "-" : OutFile.c_str(), true, Err);
if (!Err.empty()) {
fprintf(stderr, "%s\n", Err.c_str());
exit(1);
Modified: cfe/branches/Apple/objective-rewrite/tools/clang/Driver/RewriteObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/objective-rewrite/tools/clang/Driver/RewriteObjC.cpp?rev=65061&r1=65060&r2=65061&view=diff
==============================================================================
--- cfe/branches/Apple/objective-rewrite/tools/clang/Driver/RewriteObjC.cpp (original)
+++ cfe/branches/Apple/objective-rewrite/tools/clang/Driver/RewriteObjC.cpp Thu Feb 19 13:37:18 2009
@@ -372,14 +372,6 @@
FunctionDecl *SynthBlockInitFunctionDecl(const char *name);
Stmt *SynthBlockInitExpr(BlockExpr *Exp);
- void ScrubNewlines(std::string &From, std::string &To) {
- for(unsigned i = 0; i < From.length(); i++) {
- if (From[i] == '\n')
- To += "\r\n";
- else
- To += From[i];
- }
- }
void QuoteDoublequotes(std::string &From, std::string &To) {
for(unsigned i = 0; i < From.length(); i++) {
if (From[i] == '"')
@@ -4570,15 +4562,8 @@
E = ProtocolExprDecls.end(); I != E; ++I)
RewriteObjCProtocolMetaData(*I, "", "", Preamble);
- if (LangOpts.Microsoft) {
- std::string ConvertedString;
- ScrubNewlines(Preamble, ConvertedString);
- InsertText(SM->getLocForStartOfFile(MainFileID),
- ConvertedString.c_str(), ConvertedString.size(), false);
- } else {
- InsertText(SM->getLocForStartOfFile(MainFileID),
- Preamble.c_str(), Preamble.size(), false);
- }
+ InsertText(SM->getLocForStartOfFile(MainFileID),
+ Preamble.c_str(), Preamble.size(), false);
if (ClassImplementation.size() || CategoryImplementation.size())
RewriteImplementations();
@@ -4598,13 +4583,7 @@
std::string ResultStr;
SynthesizeMetaDataIntoBuffer(ResultStr);
// Emit metadata.
- if (LangOpts.Microsoft) {
- std::string ConvertedString;
- ScrubNewlines(ResultStr, ConvertedString);
- *OutFile << ConvertedString;
- } else {
- *OutFile << ResultStr;
- }
+ *OutFile << ResultStr;
}
OutFile->flush();
}
More information about the cfe-commits
mailing list