[dsymutil] Tablegenify option parsing
authorJonas Devlieghere <jonas@devlieghere.com>
Thu, 3 Oct 2019 16:34:41 +0000 (16:34 +0000)
committerJonas Devlieghere <jonas@devlieghere.com>
Thu, 3 Oct 2019 16:34:41 +0000 (16:34 +0000)
commiteddc1a4e9549241efbbe4e332b42325caf0cdb7f
tree6541aeb31c5e167dce7516c1a35d2ec69a2a3d19
parent02ac75092dbbd9efb250bfb4f4e79dd042abf3c4
[dsymutil] Tablegenify option parsing

This patch reimplements command line option parsing in dsymutil with
Tablegen and libOption. The main motivation for this change is to
prevent clashes with other cl::opt options defined in llvm. Although
it's a bit more heavyweight, it has some nice advantages such as no
global static initializers and better separation between the code and
the option definitions.

I also used this opportunity to improve how dsymutil deals with
incompatible options. Instead of having checks spread across the code,
everything is now grouped together in verifyOptions. The fact that the
options are no longer global means that we need to pass them around a
bit more, but I think it's worth the trade-off.

Differential revision: https://reviews.llvm.org/D68361

llvm-svn: 373622
llvm/test/tools/dsymutil/cmdline.test
llvm/tools/dsymutil/CMakeLists.txt
llvm/tools/dsymutil/Options.td [new file with mode: 0644]
llvm/tools/dsymutil/dsymutil.cpp