[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
This commit is contained in:
Abhina Sreeskantharajan 2021-03-26 07:12:28 -04:00
parent 6a7bcc9c8d
commit bc5d4bcc2d
2 changed files with 4 additions and 4 deletions

View File

@ -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());

View File

@ -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;
}