[PSA] Unsupported Clang options in flang-new

Hi everyone,

Recent updates to Clang’s Options.td [1] mean that various clients of clangDriver, including flang-new, gain much needed control over the visibility of Clang’s options/flags. I took this opportunity and updated flang-new [2] so that it will (correctly) issues an error when an unsupported option is used.


flang-new -fno-experimental-relative-c++-abi-vtables file.f90
flang-new: warning: argument unused during compilation: '-fno-experimental-relative-c++-abi-vtables'


flang-new -fno-experimental-relative-c++-abi-vtables file.f90
flang-new: error: unknown argument '-fno-experimental-relative-c++-abi-vtables'; did you mean '-Xclang -fno-experimental-relative-c++-abi-vtables'?

This is a very positive change for multiple reasons:

  • flang-new --help will always contain all the options that are supported,
    • Nothing less, nothing more,
    • Previously this would depend on developers remembering to update Options.td.
  • A number of annoying workarounds in the driver implementation have been removed,
    • The overall logic is now more straightforward and easier to maintain.
  • Adding new options to flang-new (and reviewing related patches) will be much easier,
    • You will be guided (through more specific build errors) where in Options.td to make updates,
    • Previously you’d have to “guess”.

This is something that I am personally very excited to see and am hoping that it will make your experience with flang-new more productive. As always, please reach out if you have any questions.

I am also mindful that some of you might rely on the old behaviour. If that’s the case, we can always refine the design.


[1] Heads-up: Clang's Options.td is being refactored and risks conflicts for downstream clients
[2] ⚙ D157837 [flang][driver] Update the visibility of Clang options in Flang