[clang] fbc3259 - [SystemZ][z/OS] Set files in FileRemapper.cpp are text

Abhina Sreeskantharajan via cfe-commits cfe-commits at lists.llvm.org
Mon Apr 19 04:59:52 PDT 2021


Author: Abhina Sreeskantharajan
Date: 2021-04-19T07:59:42-04:00
New Revision: fbc325934661076c9a7c17a5dba64c4983787503

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

LOG: [SystemZ][z/OS] Set files in FileRemapper.cpp are text

This patch sets files in FileRemapper to open as text.

Reviewed By: Jonathan.Crowther

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

Added: 
    

Modified: 
    clang/lib/ARCMigrate/FileRemapper.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/ARCMigrate/FileRemapper.cpp b/clang/lib/ARCMigrate/FileRemapper.cpp
index f536af1795ed6..92027fe4f1f4b 100644
--- a/clang/lib/ARCMigrate/FileRemapper.cpp
+++ b/clang/lib/ARCMigrate/FileRemapper.cpp
@@ -63,7 +63,7 @@ bool FileRemapper::initFromFile(StringRef filePath, DiagnosticsEngine &Diag,
   std::vector<std::pair<const FileEntry *, const FileEntry *> > pairs;
 
   llvm::ErrorOr<std::unique_ptr<llvm::MemoryBuffer>> fileBuf =
-      llvm::MemoryBuffer::getFile(infoFile);
+      llvm::MemoryBuffer::getFile(infoFile, /*IsText=*/true);
   if (!fileBuf)
     return report("Error opening file: " + infoFile, Diag);
 
@@ -121,7 +121,7 @@ bool FileRemapper::flushToFile(StringRef outputPath, DiagnosticsEngine &Diag) {
 
   std::error_code EC;
   std::string infoFile = std::string(outputPath);
-  llvm::raw_fd_ostream infoOut(infoFile, EC, llvm::sys::fs::OF_None);
+  llvm::raw_fd_ostream infoOut(infoFile, EC, llvm::sys::fs::OF_Text);
   if (EC)
     return report(EC.message(), Diag);
 
@@ -142,9 +142,10 @@ bool FileRemapper::flushToFile(StringRef outputPath, DiagnosticsEngine &Diag) {
 
       SmallString<64> tempPath;
       int fd;
-      if (fs::createTemporaryFile(path::filename(origFE->getName()),
-                                  path::extension(origFE->getName()).drop_front(), fd,
-                                  tempPath))
+      if (fs::createTemporaryFile(
+              path::filename(origFE->getName()),
+              path::extension(origFE->getName()).drop_front(), fd, tempPath,
+              llvm::sys::fs::OF_Text))
         return report("Could not create file: " + tempPath.str(), Diag);
 
       llvm::raw_fd_ostream newOut(fd, /*shouldClose=*/true);


        


More information about the cfe-commits mailing list