Port some floating point options to new option marshalling infrastructure
authorJan Svoboda <jan_svoboda@apple.com>
Mon, 9 Nov 2020 20:51:42 +0000 (15:51 -0500)
committerDuncan P. N. Exon Smith <dexonsmith@apple.com>
Mon, 9 Nov 2020 23:00:10 +0000 (18:00 -0500)
commitdbfa69c5024cfe58b8029a3766ec46c857cddb1e
tree009d1cdffd1d5ca3b728ba3ba591bfe736ea008a
parent09c6259d6d0eb51b282f6c3a28052a8146bc095b
Port some floating point options to new option marshalling infrastructure

This ports a number of OpenCL and fast-math flags for floating point
over to the new marshalling infrastructure.

As part of this, `Opt{In,Out}FFlag` were enhanced to allow other flags to
imply them, via `DefaultAnyOf<>`. For example:
```
defm signed_zeros : OptOutFFlag<"signed-zeros", ...,
  "LangOpts->NoSignedZero",
  DefaultAnyOf<[cl_no_signed_zeros, menable_unsafe_fp_math]>>;
```
defines `-fsigned-zeros` (`false`) and `-fno-signed-zeros` (`true`)
linked to the keypath `LangOpts->NoSignedZero`, defaulting to `false`,
but set to `true` implicitly if one of `-cl-no-signed-zeros` or
`-menable-unsafe-fp-math` is on.

Note that the initial patch was written Daniel Grumberg.

Differential Revision: https://reviews.llvm.org/D82756
clang/include/clang/Basic/LangOptions.def
clang/include/clang/Driver/Options.td
clang/lib/Frontend/CompilerInvocation.cpp
clang/unittests/Frontend/CompilerInvocationTest.cpp
llvm/include/llvm/Option/OptParser.td
llvm/unittests/Option/CMakeLists.txt
llvm/unittests/Option/OptionMarshallingTest.cpp [new file with mode: 0644]
llvm/unittests/Option/Opts.td
llvm/utils/TableGen/OptParserEmitter.cpp