[all-commits] [llvm/llvm-project] 5aba68: [Clang] Emit a warning for ambiguous joined '-o' a...

Joseph Huber via All-commits all-commits at lists.llvm.org
Thu Oct 6 16:20:35 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 5aba68960719c5d2de9ee0b459def9203e521f5e
      https://github.com/llvm/llvm-project/commit/5aba68960719c5d2de9ee0b459def9203e521f5e
  Author: Joseph Huber <jhuber6 at vols.utk.edu>
  Date:   2022-10-06 (Thu, 06 Oct 2022)

  Changed paths:
    M clang/include/clang/Basic/DiagnosticDriverKinds.td
    M clang/lib/Driver/Driver.cpp
    M clang/test/Driver/unknown-arg.c

  Log Message:
  -----------
  [Clang] Emit a warning for ambiguous joined '-o' arguments

The offloading toolchain makes heavy use of options beginning with
`--o`. This is problematic when combined with the joined `-o` flag. In
the following situation, the user will not get the expected output and
will not notice as the expected output will still be written.
```
clang++ -x cuda foo.cu -offload-arch=sm_80 -o foo
```

This patch introduces a warning that checks for joined `-o` arguments
that would also be a valid driver argument if an additional `-` were
added. I believe this situation is uncommon enough to warrant a warning,
and can be trivially fixed by the end user by using the more common
separate form instead.

Reviewed By: tra, MaskRay

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




More information about the All-commits mailing list