[clang][cli] Generate and round-trip language options
authorJan Svoboda <jan_svoboda@apple.com>
Tue, 9 Feb 2021 09:17:04 +0000 (10:17 +0100)
committerJan Svoboda <jan_svoboda@apple.com>
Tue, 9 Feb 2021 09:18:55 +0000 (10:18 +0100)
commit40c261c41c4ceb0dff802d6a83f7ae65af936af8
tree924ac203f9a330eafb51ac73c2806e171aaefe9c
parentd82679d8050130522ebcf90c6061211a25b1c83d
[clang][cli] Generate and round-trip language options

This patch implements generation of remaining language options and tests it by performing parse-generate-parse round trip (on by default for assert builds, off otherwise).

This patch also correctly reports failures in `parseSanitizerKinds`, which is necessary for emitting diagnostics when an invalid sanitizer is passed to `-fsanitize=` during round-trip.

This patch also removes TableGen marshalling classes from two options:
* `fsanitize_blacklist` When parsing: it's first initialized via the generated code, but then also changed by manually written code, which is confusing.
* `fopenmp` When parsing: it's first initialized via generated code, but then conditionally changed by manually written code. This is also confusing. Moreover, we need to do some extra checks when generating it, which would be really cumbersome in TableGen. (Specifically, not emitting it when `-fopenmp-simd` was present.)

Reviewed By: dexonsmith

Differential Revision: https://reviews.llvm.org/D95793
clang/include/clang/Basic/Sanitizers.h
clang/include/clang/Driver/Options.td
clang/include/clang/Frontend/CompilerInvocation.h
clang/lib/Basic/Sanitizers.cpp
clang/lib/Frontend/CompilerInvocation.cpp
clang/unittests/Basic/CMakeLists.txt
clang/unittests/Basic/SanitizersTest.cpp [new file with mode: 0644]