Author: Abhina Sreeskantharajan
Date: 2021-03-26T07:12:46-04:00
New Revision: bc5d4bcc2deb71ab647270c9754a83484b3d6f87

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

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

This patch should fix the errors shown on the Windows bots by turning off text 
mode. I plan to investigate a better fix but this should unblock the buildbots 
for now.

Reviewed By: rnk

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

Added: 
    

Modified: 
    clang/lib/Frontend/Rewrite/FrontendActions.cpp
    llvm/lib/TableGen/Main.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/Frontend/Rewrite/FrontendActions.cpp 
b/clang/lib/Frontend/Rewrite/FrontendActions.cpp
index 13e668a47a2f..45960068220b 100644
--- a/clang/lib/Frontend/Rewrite/FrontendActions.cpp
+++ b/clang/lib/Frontend/Rewrite/FrontendActions.cpp
@@ -185,7 +185,7 @@ RewriteObjCAction::CreateASTConsumer(CompilerInstance &CI, 
StringRef InFile) {
 void RewriteMacrosAction::ExecuteAction() {
   CompilerInstance &CI = getCompilerInstance();
   std::unique_ptr<raw_ostream> OS =
-      CI.createDefaultOutputFile(/*Binary=*/false, 
getCurrentFileOrBufferName());
+      CI.createDefaultOutputFile(/*Binary=*/true, 
getCurrentFileOrBufferName());
   if (!OS) return;
 
   RewriteMacrosInInput(CI.getPreprocessor(), OS.get());
@@ -194,7 +194,7 @@ void RewriteMacrosAction::ExecuteAction() {
 void RewriteTestAction::ExecuteAction() {
   CompilerInstance &CI = getCompilerInstance();
   std::unique_ptr<raw_ostream> OS =
-      CI.createDefaultOutputFile(false, getCurrentFileOrBufferName());
+      CI.createDefaultOutputFile(/*Binary=*/true, 
getCurrentFileOrBufferName());
   if (!OS) return;
 
   DoRewriteTest(CI.getPreprocessor(), OS.get());

diff  --git a/llvm/lib/TableGen/Main.cpp b/llvm/lib/TableGen/Main.cpp
index 0b1024648b66..a58defaf515f 100644
--- a/llvm/lib/TableGen/Main.cpp
+++ b/llvm/lib/TableGen/Main.cpp
@@ -93,7 +93,7 @@ int llvm::TableGenMain(const char *argv0, TableGenMainFn 
*MainFn) {
 
   Records.startTimer("Parse, build records");
   ErrorOr<std::unique_ptr<MemoryBuffer>> FileOrErr =
-      MemoryBuffer::getFileOrSTDIN(InputFilename, /*IsText=*/true);
+      MemoryBuffer::getFileOrSTDIN(InputFilename, /*IsText=*/false);
   if (std::error_code EC = FileOrErr.getError())
     return reportError(argv0, "Could not open input file '" + InputFilename +
                                   "': " + EC.message() + "\n");
@@ -138,7 +138,7 @@ int llvm::TableGenMain(const char *argv0, TableGenMainFn 
*MainFn) {
     // This prevents recompilation of all the files depending on it if there
     // aren't any.
     if (auto ExistingOrErr =
-            MemoryBuffer::getFile(OutputFilename, /*IsText=*/true))
+            MemoryBuffer::getFile(OutputFilename, /*IsText=*/false))
       if (std::move(ExistingOrErr.get())->getBuffer() == Out.str())
         WriteFile = false;
   }


        
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to