clangd icon indicating copy to clipboard operation
clangd copied to clipboard

Rename --query-driver to a more accurate description

Open recursivenomad opened this issue 2 years ago • 3 comments

After much confusion and hours of searching to finally understand the reason clangd wasn't recognizing my system headers, it all came down to allowlisting my compiler with the launch argument --query-driver=C:/mingw32/bin/* 🥴

Part of what confused me was that, based on its name, I assumed --query-driver was an option for explicitly selecting which compiler you wanted to use for syntax highlighting, rather than a flag for which drivers are allowlisted to be automatically referenced. As a result, I actively avoided looking into --query-driver as a solution, because I thought it was not an automatic solution.

Because of this confusion, I would suggest considering renaming --query-driver to something more accurate, such as
--allow-query-driver

This issue was opened following discussion with @HighCommander4 in #1896

Thank you all for developing clangd :)

recursivenomad avatar Jan 24 '24 12:01 recursivenomad

I don't have a strong opinion on this, I'll just make two minor points:

  1. Technically, --query-driver is not just a security mechanism for the user to confirm that drivers on this list are safe to execute, it's also a functional mechanism for the user to opt into the "query the driver" method for determining built-in include paths. In situations where the default ("use heuristics based on the driver path") method works fine, a user may prefer to use that default method and not opt into the "query the driver" method for reasons unrelated to security (e.g. performance).
  2. This is probably obvious, but if we were to make a change here, for backwards compatibility we'd be looking at aliasing the flag with a second name rather than renaming it.

HighCommander4 avatar Jan 26 '24 06:01 HighCommander4

I guess I'll also add, if we implement #1896 then the user will be prompted what flag they need to add, and the name of the flag becomes less important for discoverability purposes.

HighCommander4 avatar Jan 26 '24 06:01 HighCommander4

  1. Technically, --query-driver is not just a security mechanism for the user to confirm that drivers on this list are safe to execute, it's also a functional mechanism for the user to opt into the "query the driver" method for determining built-in include paths.

Ohh, interesting. Thank you for clarifying that.

I think telegraphing the security/permission functionality in its name would still be helpful, but it would be nice for the name to maintain that it's adding some overhead as well.

It would be a bit more wordy, but in that case I might suggest --allow-and-query-driver if you do consider a name change.

recursivenomad avatar Jan 26 '24 14:01 recursivenomad