[PATCH] D94313: [tools] Mark output of tools as text if it is really text

Abhina Sree via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 8 08:21:17 PST 2021


abhina.sreeskantharajan created this revision.
abhina.sreeskantharajan added reviewers: rnk, Kai, fanbo-meng, muiez, uweigand.
abhina.sreeskantharajan requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

This is a continuation of https://reviews.llvm.org/D67696. The following tools also need to set the OF_Text flag correctly.

- llvm-profdata
- llvm-link


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D94313

Files:
  llvm/tools/llvm-link/llvm-link.cpp
  llvm/tools/llvm-profdata/llvm-profdata.cpp


Index: llvm/tools/llvm-profdata/llvm-profdata.cpp
===================================================================
--- llvm/tools/llvm-profdata/llvm-profdata.cpp
+++ llvm/tools/llvm-profdata/llvm-profdata.cpp
@@ -296,7 +296,9 @@
                               ProfileFormat OutputFormat,
                               InstrProfWriter &Writer) {
   std::error_code EC;
-  raw_fd_ostream Output(OutputFilename.data(), EC, sys::fs::OF_None);
+  raw_fd_ostream Output(OutputFilename.data(), EC,
+                        OutputFormat == PF_Text ? sys::fs::OF_Text
+                                                : sys::fs::OF_None);
   if (EC)
     exitWithErrorCode(EC, OutputFilename);
 
Index: llvm/tools/llvm-link/llvm-link.cpp
===================================================================
--- llvm/tools/llvm-link/llvm-link.cpp
+++ llvm/tools/llvm-link/llvm-link.cpp
@@ -456,7 +456,8 @@
     errs() << "Here's the assembly:\n" << *Composite;
 
   std::error_code EC;
-  ToolOutputFile Out(OutputFilename, EC, sys::fs::OF_None);
+  ToolOutputFile Out(OutputFilename, EC,
+                     OutputAssembly ? sys::fs::OF_Text : sys::fs::OF_None);
   if (EC) {
     WithColor::error() << EC.message() << '\n';
     return 1;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D94313.315410.patch
Type: text/x-patch
Size: 1235 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210108/db930acb/attachment.bin>


More information about the llvm-commits mailing list