[all-commits] [llvm/llvm-project] 5f2cf3: [Clang][Preprocessor] Fix inconsistent `FLT_EVAL_M...
Egor Zhdan via All-commits
all-commits at lists.llvm.org
Wed Jun 29 11:36:57 PDT 2022
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 5f2cf3a21f3aabff85d178a110602ce150914ff7
https://github.com/llvm/llvm-project/commit/5f2cf3a21f3aabff85d178a110602ce150914ff7
Author: Egor Zhdan <e_zhdan at apple.com>
Date: 2022-06-29 (Wed, 29 Jun 2022)
Changed paths:
M clang/lib/Lex/Preprocessor.cpp
M clang/lib/Sema/Sema.cpp
M clang/test/Preprocessor/flt_eval_macro.cpp
Log Message:
-----------
[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
More information about the All-commits
mailing list