Previously, we had a loop to iterate over options starting with
--plugin-opt= and parse them by hand. But we can make OptTable
do that job for us.
Details
Diff Detail
- Build Status
Buildable 18427 Build 18427: arc lint + arc unit
Event Timeline
I think these options can also be spelt -plugin-opt foo as well as -plugin-opt=foo. Can you see a good way to handle that?
Sure, I think I can just use Eq instead of J, but I'd like to do that in a follow-up patch because the options without = are not handled now.
Are you sure? It certainly looks like they are handled, e.g.
$ ra/bin/ld.lld -plugin-opt Of ra/bin/ld.lld: error: -plugin-opt=Of: number expected, but got 'f' ra/bin/ld.lld: error: target emulation unknown: -m or at least one .o file required
Ouch. I don't know if there's a good way to handle options in that style. One way of doing it is to iterate over argv before passing it to OptParser to concatenate --plugin-opt and the following option with =. It doesn't feel that bad, but I'm not very sure if that's a good thing to do.
lld/ELF/DriverUtils.cpp | ||
---|---|---|
106 ↗ | (On Diff #147916) | I don't think this correctly handles the case where the last two arguments are -plugin-opt foo. Won't you end up with an out of bounds access? |