[PATCH] D134550: [Clang] Make Clang driver suggest '-Xclang' for CC1 options passed to the driver

Joseph Huber via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Sep 23 12:00:58 PDT 2022


jhuber6 added a comment.

In D134550#3812369 <https://reviews.llvm.org/D134550#3812369>, @aaron.ballman wrote:

> This is a neat idea, but I think we should think about it carefully. In general, `-Xclang` is not something we want to actively recommend users use, so do we really want to make it easier for users to use?

Thanks for the feedback, I mostly figured I'd throw out this patch since it took a few minutes to make and I've forgotten a few times which arguments need the `-Xclang` during Clang development. If you think that users shouldn't be exposed to that then it's probably best to hide it from them.

> One potential problem that could be caused by this change is when we have a driver option that the user typos but happens to match a -cc1 argument; I could see inattentive users going "cool, I'll add -Xclang then" instead of fixing the driver arg; but I've not looked through our existing options to see if that situation is particularly *likely* or not.

The logic outlined here should only fire if there is no close match. We only check if the input is a `cc1` option right before outputting the normal `unknown argument` warning without a suggestion.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D134550



More information about the cfe-commits mailing list