[PATCH] D135076: [Clang] Make offloading flags accept '-' and '--'

Joseph Huber via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Oct 3 09:08:50 PDT 2022


jhuber6 added a comment.

In D135076#3830914 <https://reviews.llvm.org/D135076#3830914>, @MaskRay wrote:

> Single-dash long options starting with `-o` conflict with the short option `-o` so I am unsure I like this direction.
>
>> However, if a user uses a single dash it will instead name a file 'ffload-arch' for example.
>
> That's intended. A user should be able to specify an output name `ffload-arch` with `-offload-arch`.

I made this patch primarily because I've gotten tired of getting messages from users wondering why their code wasn't offloading to the correct architecture only when they used `-offload-arch=`. This is something that's not clearly obvious to users and I think it's highly unlikely that a user would want a file named `-ffload-arch`.

>> This is similar to many other driver arguments beginning with -o.
>
> What options?

There were just a few I saw after running `clang --help 2>&1 | grep -e '^\ *-o`. It was just a handful but I figured having anything more than `-o` meant this would be uncontroversial.

In D135076#3830931 <https://reviews.llvm.org/D135076#3830931>, @MaskRay wrote:

> I think this should be reverted. It's moving in the backward direction.

That's fine if you think that this is unacceptable with the existing semantics. Maybe an alternative route would be to re-parse `-o` options and give a warning if it matches a recognized option? I feel like using `-o` without a space is uncommon enough to warrant it.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D135076/new/

https://reviews.llvm.org/D135076



More information about the cfe-commits mailing list