[clang] 23929af - [Windows] Turn off text mode correctly in Rewriter to stop CRLF translation

Abhina Sreeskantharajan via cfe-commits cfe-commits at lists.llvm.org
Tue Apr 6 07:49:16 PDT 2021


Author: Abhina Sreeskantharajan
Date: 2021-04-06T10:49:09-04:00
New Revision: 23929af383f27a6ddf23704192a25591481152b3

URL: https://github.com/llvm/llvm-project/commit/23929af383f27a6ddf23704192a25591481152b3
DIFF: https://github.com/llvm/llvm-project/commit/23929af383f27a6ddf23704192a25591481152b3.diff

LOG: [Windows] Turn off text mode correctly in Rewriter to stop CRLF translation

I incorrectly changed the RewriteTestAction::ExecuteAction's file to binary instead of the proper RewriteIncludesAction::BeginSourceFileAction in https://reviews.llvm.org/rGbc5d4bcc2deb71ab647270c9754a83484b3d6f87. In the original commit, I actually changed RewriteIncludesAction::BeginSourceFileAction in https://reviews.llvm.org/rGfdb640ea30d416368b76b68b106deda580c6aced. This should fix the issue @aganea is facing.

Reviewed By: aganea

Differential Revision: https://reviews.llvm.org/D99837

Added: 
    

Modified: 
    clang/lib/Frontend/Rewrite/FrontendActions.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/Frontend/Rewrite/FrontendActions.cpp b/clang/lib/Frontend/Rewrite/FrontendActions.cpp
index 45960068220b..09ed07be923e 100644
--- a/clang/lib/Frontend/Rewrite/FrontendActions.cpp
+++ b/clang/lib/Frontend/Rewrite/FrontendActions.cpp
@@ -194,7 +194,7 @@ void RewriteMacrosAction::ExecuteAction() {
 void RewriteTestAction::ExecuteAction() {
   CompilerInstance &CI = getCompilerInstance();
   std::unique_ptr<raw_ostream> OS =
-      CI.createDefaultOutputFile(/*Binary=*/true, getCurrentFileOrBufferName());
+      CI.createDefaultOutputFile(/*Binary=*/false, getCurrentFileOrBufferName());
   if (!OS) return;
 
   DoRewriteTest(CI.getPreprocessor(), OS.get());
@@ -270,7 +270,7 @@ class RewriteIncludesAction::RewriteImportsListener : public ASTReaderListener {
 bool RewriteIncludesAction::BeginSourceFileAction(CompilerInstance &CI) {
   if (!OutputStream) {
     OutputStream =
-        CI.createDefaultOutputFile(/*Binary=*/false, getCurrentFileOrBufferName());
+        CI.createDefaultOutputFile(/*Binary=*/true, getCurrentFileOrBufferName());
     if (!OutputStream)
       return false;
   }


        


More information about the cfe-commits mailing list