Skip to content

Commit 051a699

Browse files
committed
[llvm-objdump] Simplify PrintHelpMessage() logic
This relands rL358418. It missed one test that should also use -macho Note, all the other -private-header -exports-trie tests are used together with -macho. llvm-svn: 358472
1 parent 474a967 commit 051a699

File tree

3 files changed

+13
-31
lines changed

3 files changed

+13
-31
lines changed
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
RUN: llvm-objdump -exports-trie %p/Inputs/macho-no-exports.dylib | FileCheck %s
1+
RUN: llvm-objdump -macho -exports-trie %p/Inputs/macho-no-exports.dylib | FileCheck %s
22

33
; Test that we don't crash with an empty export list.
4-
CHECK: macho-no-exports.dylib: file format Mach-O 64-bit x86-64
4+
CHECK: macho-no-exports.dylib
5+
CHECK: Exports trie:

llvm/test/tools/llvm-objdump/X86/macho-private-header.test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: llvm-objdump -private-header %p/Inputs/hello.obj.macho-x86_64 | FileCheck %s
1+
// RUN: llvm-objdump -macho -private-header %p/Inputs/hello.obj.macho-x86_64 | FileCheck %s
22

33
CHECK: Mach header
44
CHECK: magic cputype cpusubtype caps filetype ncmds sizeofcmds flags

llvm/tools/llvm-objdump/llvm-objdump.cpp

Lines changed: 9 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -2008,34 +2008,15 @@ int main(int argc, char **argv) {
20082008
if (DisassembleAll || PrintSource || PrintLines)
20092009
Disassemble = true;
20102010

2011-
if (!Disassemble
2012-
&& !Relocations
2013-
&& !DynamicRelocations
2014-
&& !SectionHeaders
2015-
&& !SectionContents
2016-
&& !SymbolTable
2017-
&& !UnwindInfo
2018-
&& !PrivateHeaders
2019-
&& !FileHeaders
2020-
&& !FirstPrivateHeader
2021-
&& !ExportsTrie
2022-
&& !Rebase
2023-
&& !Bind
2024-
&& !LazyBind
2025-
&& !WeakBind
2026-
&& !RawClangAST
2027-
&& !(UniversalHeaders && MachOOpt)
2028-
&& !ArchiveHeaders
2029-
&& !(IndirectSymbols && MachOOpt)
2030-
&& !(DataInCode && MachOOpt)
2031-
&& !(LinkOptHints && MachOOpt)
2032-
&& !(InfoPlist && MachOOpt)
2033-
&& !(DylibsUsed && MachOOpt)
2034-
&& !(DylibId && MachOOpt)
2035-
&& !(ObjcMetaData && MachOOpt)
2036-
&& !(!FilterSections.empty() && MachOOpt)
2037-
&& !FaultMapSection
2038-
&& DwarfDumpType == DIDT_Null) {
2011+
if (!ArchiveHeaders && !Disassemble && DwarfDumpType == DIDT_Null &&
2012+
!DynamicRelocations && !FileHeaders && !PrivateHeaders && !RawClangAST &&
2013+
!Relocations && !SectionHeaders && !SectionContents && !SymbolTable &&
2014+
!UnwindInfo && !FaultMapSection &&
2015+
!(MachOOpt &&
2016+
(Bind || DataInCode || DylibId || DylibsUsed || ExportsTrie ||
2017+
FirstPrivateHeader || IndirectSymbols || InfoPlist || LazyBind ||
2018+
LinkOptHints || ObjcMetaData || Rebase || UniversalHeaders ||
2019+
WeakBind || !FilterSections.empty()))) {
20392020
cl::PrintHelpMessage();
20402021
return 2;
20412022
}

0 commit comments

Comments
 (0)