]> granicus.if.org Git - llvm/commitdiff
[llvm-objdump] Simplify PrintHelpMessage() logic
authorFangrui Song <maskray@google.com>
Tue, 16 Apr 2019 02:37:29 +0000 (02:37 +0000)
committerFangrui Song <maskray@google.com>
Tue, 16 Apr 2019 02:37:29 +0000 (02:37 +0000)
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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358472 91177308-0d34-0410-b5e6-96231b3b80d8

test/Object/objdump-export-list.test
test/tools/llvm-objdump/X86/macho-private-header.test
tools/llvm-objdump/llvm-objdump.cpp

index 74344c1c2e2e7ff20834090ecffbd7bb217cd6b0..1728f73d8b40c7ec2a065bf6ec9f89dc6471aeb9 100644 (file)
@@ -1,4 +1,5 @@
-RUN: llvm-objdump -exports-trie %p/Inputs/macho-no-exports.dylib | FileCheck %s
+RUN: llvm-objdump -macho -exports-trie %p/Inputs/macho-no-exports.dylib | FileCheck %s
 
 ; Test that we don't crash with an empty export list.
-CHECK: macho-no-exports.dylib: file format Mach-O 64-bit x86-64
+CHECK: macho-no-exports.dylib
+CHECK: Exports trie:
index d90072542a2e879c776afc195430051760b3cf31..b904bbcf5ec02115fc1c1c3f502381b5a5c3554c 100644 (file)
@@ -1,4 +1,4 @@
-// RUN: llvm-objdump -private-header %p/Inputs/hello.obj.macho-x86_64 | FileCheck %s
+// RUN: llvm-objdump -macho -private-header %p/Inputs/hello.obj.macho-x86_64 | FileCheck %s
 
 CHECK: Mach header
 CHECK:       magic cputype cpusubtype  caps    filetype ncmds sizeofcmds      flags
index bc688d6ca94321a82e061258ba35bf2d2388d43b..2606d9b20c2154c1f72f59916dc146be10c90021 100644 (file)
@@ -2008,34 +2008,15 @@ int main(int argc, char **argv) {
   if (DisassembleAll || PrintSource || PrintLines)
     Disassemble = true;
 
-  if (!Disassemble
-      && !Relocations
-      && !DynamicRelocations
-      && !SectionHeaders
-      && !SectionContents
-      && !SymbolTable
-      && !UnwindInfo
-      && !PrivateHeaders
-      && !FileHeaders
-      && !FirstPrivateHeader
-      && !ExportsTrie
-      && !Rebase
-      && !Bind
-      && !LazyBind
-      && !WeakBind
-      && !RawClangAST
-      && !(UniversalHeaders && MachOOpt)
-      && !ArchiveHeaders
-      && !(IndirectSymbols && MachOOpt)
-      && !(DataInCode && MachOOpt)
-      && !(LinkOptHints && MachOOpt)
-      && !(InfoPlist && MachOOpt)
-      && !(DylibsUsed && MachOOpt)
-      && !(DylibId && MachOOpt)
-      && !(ObjcMetaData && MachOOpt)
-      && !(!FilterSections.empty() && MachOOpt)
-      && !FaultMapSection
-      && DwarfDumpType == DIDT_Null) {
+  if (!ArchiveHeaders && !Disassemble && DwarfDumpType == DIDT_Null &&
+      !DynamicRelocations && !FileHeaders && !PrivateHeaders && !RawClangAST &&
+      !Relocations && !SectionHeaders && !SectionContents && !SymbolTable &&
+      !UnwindInfo && !FaultMapSection &&
+      !(MachOOpt &&
+        (Bind || DataInCode || DylibId || DylibsUsed || ExportsTrie ||
+         FirstPrivateHeader || IndirectSymbols || InfoPlist || LazyBind ||
+         LinkOptHints || ObjcMetaData || Rebase || UniversalHeaders ||
+         WeakBind || !FilterSections.empty()))) {
     cl::PrintHelpMessage();
     return 2;
   }