[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
Mon Jan 11 07:19:23 PST 2021


abhina.sreeskantharajan updated this revision to Diff 315803.
abhina.sreeskantharajan added a comment.

Sorry, I wasn't aware Windows didn't support "diff -B". I will try "diff -b" which appears in other lit tests.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D94313/new/

https://reviews.llvm.org/D94313

Files:
  llvm/test/tools/llvm-profdata/csprof-dump.test
  llvm/test/tools/llvm-profdata/instr-remap.test
  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;
Index: llvm/test/tools/llvm-profdata/instr-remap.test
===================================================================
--- llvm/test/tools/llvm-profdata/instr-remap.test
+++ llvm/test/tools/llvm-profdata/instr-remap.test
@@ -1,2 +1,2 @@
 ; RUN: llvm-profdata merge -text %S/Inputs/instr-remap.proftext -r %S/Inputs/instr-remap.remap -o %t.output
-; RUN: diff %S/Inputs/instr-remap.expected %t.output
+; RUN: diff -b %S/Inputs/instr-remap.expected %t.output
Index: llvm/test/tools/llvm-profdata/csprof-dump.test
===================================================================
--- llvm/test/tools/llvm-profdata/csprof-dump.test
+++ llvm/test/tools/llvm-profdata/csprof-dump.test
@@ -27,5 +27,5 @@
 
 RUN: llvm-profdata merge -o %t.0.profdata %S/Inputs/CSIR_profile.proftext
 RUN: llvm-profdata merge -text -o %t.0.proftext %t.0.profdata
-RUN: diff %t.0.proftext %S/Inputs/CSIR_profile.proftext
+RUN: diff -b %t.0.proftext %S/Inputs/CSIR_profile.proftext
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D94313.315803.patch
Type: text/x-patch
Size: 2196 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210111/6e24b512/attachment.bin>


More information about the llvm-commits mailing list