diff options
author | Ben Langmuir <blangmuir@apple.com> | 2023-02-08 13:24:07 -0800 |
---|---|---|
committer | Ben Langmuir <blangmuir@apple.com> | 2023-02-08 14:23:39 -0800 |
commit | cf73d3f07b5b0ff83a852dfdf8857500e86f9952 (patch) | |
tree | 370693ec61b0f9fa55e943d200cdc9a1c10ec302 /clang/lib/Basic/LangOptions.cpp | |
parent | 79971d0d771a273eaf13697c3a2e55fc0194bc09 (diff) | |
download | llvm-cf73d3f07b5b0ff83a852dfdf8857500e86f9952.zip llvm-cf73d3f07b5b0ff83a852dfdf8857500e86f9952.tar.gz llvm-cf73d3f07b5b0ff83a852dfdf8857500e86f9952.tar.bz2 |
[clang][deps] Ensure module invocation can be serialized
When reseting modular options, propagate the values from certain options
that have ImpliedBy relations instead of setting to the default. Also,
verify in clang-scan-deps that the command line produced round trips
exactly.
Ideally we would automatically derive the set of options that need this
kind of propagation, but for now there aren't very many impacted.
rdar://105148590
Differential Revision: https://reviews.llvm.org/D143446
Diffstat (limited to 'clang/lib/Basic/LangOptions.cpp')
-rw-r--r-- | clang/lib/Basic/LangOptions.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/clang/lib/Basic/LangOptions.cpp b/clang/lib/Basic/LangOptions.cpp index 753b6bf..f22fe9a 100644 --- a/clang/lib/Basic/LangOptions.cpp +++ b/clang/lib/Basic/LangOptions.cpp @@ -29,6 +29,14 @@ void LangOptions::resetNonModularOptions() { Name = static_cast<unsigned>(Default); #include "clang/Basic/LangOptions.def" + // Reset "benign" options with implied values (Options.td ImpliedBy relations) + // rather than their defaults. This avoids unexpected combinations and + // invocations that cannot be round-tripped to arguments. + // FIXME: we should derive this automatically from ImpliedBy in tablegen. + AllowFPReassoc = UnsafeFPMath; + NoHonorNaNs = FiniteMathOnly; + NoHonorInfs = FiniteMathOnly; + // These options do not affect AST generation. NoSanitizeFiles.clear(); XRayAlwaysInstrumentFiles.clear(); |