Updated in 2023-05.
There are two libraries for processing command line options in
LLVM.
llvm/Support/ComandLine.h
See https://llvm.org/docs/CommandLine.html for
documentation.
Global variables (mostly llvm::cl::opt<type>
, some
llvm::cl::list<type>
) are most common to represent
command-line options. The llvm::cl::opt
constructor
registers this command line option in a global registry. The program
calls llvm::cl::ParseCommandLineOptions(argc, argv, ...)
in
main
to parse the command line options. opt
supports various integer types, bool
,
std::string
, etc. Defining some specialization can support
support custom class/enum types.
Read More