[llvm] abd7078 - [llvm-size] print a blank line between archieve members when using sysv format
Jim Lin via llvm-commits
llvm-commits at lists.llvm.org
Thu Jan 2 22:02:07 PST 2020
Author: TH3CHARLie
Date: 2020-01-03T14:05:55+08:00
New Revision: abd707848bcd52d55e9c203f96a0a826ba56f26f
URL: https://github.com/llvm/llvm-project/commit/abd707848bcd52d55e9c203f96a0a826ba56f26f
DIFF: https://github.com/llvm/llvm-project/commit/abd707848bcd52d55e9c203f96a0a826ba56f26f.diff
LOG: [llvm-size] print a blank line between archieve members when using sysv format
Summary: This patch is related to https://bugs.llvm.org/show_bug.cgi?id=42967 and it fixes llvm-size's sysv format output by adding a blank line between archieve members
Reviewers: jhenderson, Jim, MaskRay
Reviewed By: jhenderson, Jim, MaskRay
Subscribers: MaskRay, Jim, rupprecht, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D71957
Added:
Modified:
llvm/test/tools/llvm-size/archive.test
llvm/test/tools/llvm-size/multiple-inputs.test
llvm/test/tools/llvm-size/radix.test
llvm/tools/llvm-size/llvm-size.cpp
Removed:
################################################################################
diff --git a/llvm/test/tools/llvm-size/archive.test b/llvm/test/tools/llvm-size/archive.test
index b750f084c271..23c4cd10c491 100644
--- a/llvm/test/tools/llvm-size/archive.test
+++ b/llvm/test/tools/llvm-size/archive.test
@@ -8,8 +8,7 @@
# RUN: llvm-ar rc %t1.a
# RUN: llvm-size -B %t1.a | count 0
-## Sysv output prints a single blank line in this case.
-# RUN: llvm-size -A %t1.a | FileCheck %s --implicit-check-not={{.}}
+# RUN: llvm-size -A %t1.a | count 0
## Case 2: Single member.
# RUN: rm -f %t2.a
@@ -48,6 +47,7 @@
# SYSV-3-NEXT: .bss 4 1
# SYSV-3-NEXT: Total 7
# SYSV-3-EMPTY:
+# SYSV-3-EMPTY:
# SYSV-3-NEXT: archive.test.tmp1 (ex [[ARCHIVE2]]):
# SYSV-3-NEXT: section size addr
# SYSV-3-NEXT: .text 1 4
@@ -55,6 +55,7 @@
# SYSV-3-NEXT: .bss 4 1
# SYSV-3-NEXT: Total 7
# SYSV-3-EMPTY:
+# SYSV-3-EMPTY:
# SYSV-3-NEXT: [[FILE2]] :
# SYSV-3-NEXT: section size addr
# SYSV-3-NEXT: .text 8 32
@@ -69,6 +70,8 @@
# SYSV-1-NEXT: .data 2 2
# SYSV-1-NEXT: .bss 4 1
# SYSV-1-NEXT: Total 7
+# SYSV-1-EMPTY:
+# SYSV-1-EMPTY:
# SYSV-2-NEXT: archive.test.tmp2 (ex [[ARCHIVE]]):
# SYSV-2-NEXT: section size addr
diff --git a/llvm/test/tools/llvm-size/multiple-inputs.test b/llvm/test/tools/llvm-size/multiple-inputs.test
index 96c3c21de89e..7fc2d1421c23 100644
--- a/llvm/test/tools/llvm-size/multiple-inputs.test
+++ b/llvm/test/tools/llvm-size/multiple-inputs.test
@@ -17,6 +17,7 @@
# SYSV-NEXT: .bss 4 1
# SYSV-NEXT: Total 7
# SYSV-EMPTY:
+# SYSV-EMPTY:
# SYSV-NEXT: [[FILE2]] :
# SYSV-NEXT: section size addr
# SYSV-NEXT: .text 8 32
diff --git a/llvm/test/tools/llvm-size/radix.test b/llvm/test/tools/llvm-size/radix.test
index e8fea8bd8550..021133593f54 100644
--- a/llvm/test/tools/llvm-size/radix.test
+++ b/llvm/test/tools/llvm-size/radix.test
@@ -49,6 +49,7 @@
# OCT-SYSV-NEXT: .bss 04 01
# OCT-SYSV-NEXT: Total 07
# OCT-SYSV-EMPTY:
+# OCT-SYSV-EMPTY:
# OCT-SYSV-NEXT: [[FILE2]] :
# OCT-SYSV-NEXT: section size addr
# OCT-SYSV-NEXT: .blob 010 040
@@ -69,6 +70,7 @@
# DEC-SYSV-NEXT: .bss 4 1
# DEC-SYSV-NEXT: Total 7
# DEC-SYSV-EMPTY:
+# DEC-SYSV-EMPTY:
# DEC-SYSV-NEXT: [[FILE2]] :
# DEC-SYSV-NEXT: section size addr
# DEC-SYSV-NEXT: .blob 8 32
@@ -89,6 +91,7 @@
# HEX-SYSV-NEXT: .bss 0x4 0x1
# HEX-SYSV-NEXT: Total 0x7
# HEX-SYSV-EMPTY:
+# HEX-SYSV-EMPTY:
# HEX-SYSV-NEXT: [[FILE2]] :
# HEX-SYSV-NEXT: section size addr
# HEX-SYSV-NEXT: .blob 0x8 0x20
diff --git a/llvm/tools/llvm-size/llvm-size.cpp b/llvm/tools/llvm-size/llvm-size.cpp
index 7c63bc291f1b..46ece5a6f0c9 100644
--- a/llvm/tools/llvm-size/llvm-size.cpp
+++ b/llvm/tools/llvm-size/llvm-size.cpp
@@ -446,7 +446,8 @@ static void printObjectSectionSizes(ObjectFile *Obj) {
fmt << "%-" << max_name_len << "s "
<< "%#" << max_size_len << radix_fmt << "\n";
outs() << format(fmt.str().c_str(), static_cast<const char *>("Total"),
- total);
+ total)
+ << "\n\n";
} else {
// The Berkeley format does not display individual section sizes. It
// displays the cumulative size for each section type.
@@ -839,9 +840,6 @@ static void printFileSectionSizes(StringRef file) {
} else {
error("unsupported file type", file);
}
- // System V adds an extra newline at the end of each file.
- if (OutputFormat == sysv)
- outs() << "\n";
}
static void printBerkeleyTotals() {
More information about the llvm-commits
mailing list