[Clang][Preprocessor] Fix inconsistent `FLT_EVAL_METHOD` when compiling vs preprocessing
When running `clang -E -Ofast` on macOS, the `__FLT_EVAL_METHOD__` macro is `0`, which causes the following typedef to be emitted into the preprocessed source: `typedef float float_t`. However, when running `clang -c -Ofast`, `__FLT_EVAL_METHOD__` is `-1`, and `typedef long double float_t` is emitted. This causes build errors for certain projects, which are not reproducible when compiling from preprocessed source. The issue is that `__FLT_EVAL_METHOD__` is configured in `Sema::Sema` which is not executed when running in `-E` mode. This change moves that logic into the preprocessor initialization method, which is invoked correctly in `-E` mode. rdar://96134605 rdar://92748429 Differential Revision: https://reviews.llvm.org/D128814
Loading
Please sign in to comment