Some projects call $AR like "$AR -crs output input1 input2".
This implementation isn't very pretty - any suggestions on a better way of handling it?
Differential D39538
[llvm-ar] Support an options string that start with a dash mstorsjo on Nov 2 2017, 2:20 AM. Authored by
Details Some projects call $AR like "$AR -crs output input1 input2". This implementation isn't very pretty - any suggestions on a better way of handling it?
Diff Detail Event TimelineComment Actions Not sure of a better implementation strategy, but I am a fan of adding support for the dashed variants, since I've hit the issue as well in the past. Comment Actions lgtm
Comment Actions Why don't you just strip the leading dash? I think the first argument is always flags (e.g. ar somesome.a doesn't make sense), so we could always handle ar -something as if ar something. Comment Actions The big issue is that llvm-ar has got options of its own that are dash/doubledash-prefixed, so you can have llvm-ar -format gnu [-]crs foo.a obj.o. We don't know what of these are options and what are "all the other args" until we run the command line parser.
|
If you are going to use StringRef, then something like this is probably better than using stdlib's string functions.