[clang] Mark the file opened by DeserializedDeclsSourceRangePrinter as a text file (PR #135842)

via cfe-commits cfe-commits at lists.llvm.org
Tue Apr 15 12:14:53 PDT 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang

Author: Zibi Sarbinowski (zibi2)

<details>
<summary>Changes</summary>

This PR will fix the following lit failure seeing on z/OS and most likely on Windows:

`FAIL: Clang :: Frontend/dump-minimization-hints.cpp`

Without `OF_TextWithCRLF` flag, a file is treated as binary and is read improperly.

---
Full diff: https://github.com/llvm/llvm-project/pull/135842.diff


1 Files Affected:

- (modified) clang/lib/Frontend/FrontendAction.cpp (+1-1) 


``````````diff
diff --git a/clang/lib/Frontend/FrontendAction.cpp b/clang/lib/Frontend/FrontendAction.cpp
index bd084aa94fc37..1c4dec08575d1 100644
--- a/clang/lib/Frontend/FrontendAction.cpp
+++ b/clang/lib/Frontend/FrontendAction.cpp
@@ -312,7 +312,7 @@ FrontendAction::CreateWrappedASTConsumer(CompilerInstance &CI,
     std::error_code ErrorCode;
     auto FileStream = std::make_unique<llvm::raw_fd_ostream>(
         DumpDeserializedDeclarationRangesPath, ErrorCode,
-        llvm::sys::fs::OF_None);
+        llvm::sys::fs::OF_TextWithCRLF);
     if (!ErrorCode) {
       Consumers.push_back(std::make_unique<DeserializedDeclsSourceRangePrinter>(
           CI.getSourceManager(), std::move(FileStream)));

``````````

</details>


https://github.com/llvm/llvm-project/pull/135842


More information about the cfe-commits mailing list