Skip to content

Commit 5997c94

Browse files
committed
Fix a bug with llvm-size and the -m option with multiple files not printing the file names.
llvm-svn: 288402
1 parent 6a8704c commit 5997c94

File tree

3 files changed

+7
-1
lines changed

3 files changed

+7
-1
lines changed
228 Bytes
Binary file not shown.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
RUN: llvm-size -m %p/Inputs/darwin-m.o | FileCheck --check-prefix="DARWIN" %s
2+
RUN: llvm-size -m %p/Inputs/darwin-m.o %p/Inputs/darwin-m1.o | FileCheck --check-prefix="DARWIN2" %s
23

34
DARWIN: Segment : 8
45
DARWIN-NEXT: Section (__TEXT, __text): 4
56
DARWIN-NEXT: Section (__DATA, __data): 4
67
DARWIN-NEXT: total 8
78
DARWIN-NEXT: total 8
9+
10+
DARWIN2: Inputs/darwin-m.o:
11+
DARWIN2: Inputs/darwin-m1.o:

llvm/tools/llvm-size/llvm-size.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -817,11 +817,13 @@ static void printFileSectionSizes(StringRef file) {
817817
} else if (ObjectFile *o = dyn_cast<ObjectFile>(&Bin)) {
818818
if (!checkMachOAndArchFlags(o, file))
819819
return;
820+
MachOObjectFile *MachO = dyn_cast<MachOObjectFile>(o);
820821
if (OutputFormat == sysv)
821822
outs() << o->getFileName() << " :\n";
823+
else if (MachO && OutputFormat == darwin && MoreThanOneFile)
824+
outs() << o->getFileName() << ":\n";
822825
printObjectSectionSizes(o);
823826
if (OutputFormat == berkeley) {
824-
MachOObjectFile *MachO = dyn_cast<MachOObjectFile>(o);
825827
if (!MachO || MoreThanOneFile)
826828
outs() << o->getFileName();
827829
outs() << "\n";

0 commit comments

Comments
 (0)