[llvm-branch-commits] [llvm] 8ad998a - [tools] Mark output of tools as text if it is really text

Abhina Sreeskantharajan via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Mon Jan 11 12:18:52 PST 2021


Author: Abhina Sreeskantharajan
Date: 2021-01-11T15:14:03-05:00
New Revision: 8ad998a6115a8cd59a18ebdd5ec65329e42050e7

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

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

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

Reviewed By: rnk

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

Added: 
    

Modified: 
    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

Removed: 
    


################################################################################
diff  --git a/llvm/test/tools/llvm-profdata/csprof-dump.test b/llvm/test/tools/llvm-profdata/csprof-dump.test
index 39643dc38f20..a03b9d8a003e 100644
--- a/llvm/test/tools/llvm-profdata/csprof-dump.test
+++ b/llvm/test/tools/llvm-profdata/csprof-dump.test
@@ -27,5 +27,5 @@ Roundtrip test:
 
 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
 

diff  --git a/llvm/test/tools/llvm-profdata/instr-remap.test b/llvm/test/tools/llvm-profdata/instr-remap.test
index 159b7374ac35..27fddf609581 100644
--- a/llvm/test/tools/llvm-profdata/instr-remap.test
+++ b/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

diff  --git a/llvm/tools/llvm-link/llvm-link.cpp b/llvm/tools/llvm-link/llvm-link.cpp
index 61d0c1561054..158b168107f1 100644
--- a/llvm/tools/llvm-link/llvm-link.cpp
+++ b/llvm/tools/llvm-link/llvm-link.cpp
@@ -456,7 +456,8 @@ int main(int argc, char **argv) {
     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;

diff  --git a/llvm/tools/llvm-profdata/llvm-profdata.cpp b/llvm/tools/llvm-profdata/llvm-profdata.cpp
index 122ffe73bf0f..ad188b6a5e92 100644
--- a/llvm/tools/llvm-profdata/llvm-profdata.cpp
+++ b/llvm/tools/llvm-profdata/llvm-profdata.cpp
@@ -296,7 +296,9 @@ static void writeInstrProfile(StringRef OutputFilename,
                               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);
 


        


More information about the llvm-branch-commits mailing list