llvmorg-github-actions[bot] wrote:

<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang

Author: Zibi Sarbinowski (zibi2)

<details>
<summary>Changes</summary>

When opening the log file in `AtomicLineLogger::openLogFile`, specify 
`OF_TextWithCRLF` in addition to `OF_Append`.

On platforms like z/OS (`__MVS__`), omitting `OF_Text` tags the newly created 
file as binary and disables auto-conversion. Consequently, log lines written as 
ASCII/UTF-8 cannot be processed by native system tools like `grep`, causing 
tests such as `ClangScanDeps/logging-two-threads.c` to fail when grepping the 
log file. Adding `OF_TextWithCRLF` ensures the file is opened in text mode with 
proper file tagging and character conversion.

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


1 Files Affected:

- (modified) clang/lib/Basic/AtomicLineLogger.cpp (+2-1) 


``````````diff
diff --git a/clang/lib/Basic/AtomicLineLogger.cpp 
b/clang/lib/Basic/AtomicLineLogger.cpp
index 592e1cd63594c..250342ab86683 100644
--- a/clang/lib/Basic/AtomicLineLogger.cpp
+++ b/clang/lib/Basic/AtomicLineLogger.cpp
@@ -54,7 +54,8 @@ static int openLogFile(StringRef Path) {
 #else
   int FD = -1;
   std::error_code EC = llvm::sys::fs::openFileForWrite(
-      Path, FD, llvm::sys::fs::CD_OpenAlways, llvm::sys::fs::OF_Append);
+      Path, FD, llvm::sys::fs::CD_OpenAlways,
+      llvm::sys::fs::OF_Append | llvm::sys::fs::OF_TextWithCRLF);
   if (EC) {
     llvm::errs() << "warning: unable to open log file '" << Path
                  << "': " << EC.message() << "\n";

``````````

</details>


https://github.com/llvm/llvm-project/pull/243986
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to