[flang][driver] Refactor methods for parsing options (nfc)

Authored by awarzynski on Apr 14 2021, 4:42 AM.


[flang][driver] Refactor methods for parsing options (nfc)

This is just a small update that makes sure that errors arising from
parsing command-line options are captured more visibly. Also, all
parsing methods will now consistently return either a bool ("may fail")
or void ("never fails").

An instance of InputKind coming from -x is added to
FrontendOptions rather then being returned from ParseFrontendArgs.
It's currently not used, but we will require it shortly. In particular,
once code-generation is available we will use it to differentiate
between LLVM IR and Fortran input. FrontendOptions is a very suitable
place to keep it.

This changes don't affect the error reporting in the driver. In this
respect these are non-functional-changes. However, it will simplify
things in the forthcoming patches in which we may need a better error
tracking/recovery mechanism.

Differential Revision: https://reviews.llvm.org/D100556