[PATCH] D136036: [Clang] Add __has_builtin_constexpr support
Evgeny Shulgin via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Sun Oct 16 04:42:16 PDT 2022
Izaron added a comment.
A builtin is considered "constexpr" if it has `E` in its attributes in `Builtins.def`.
The list of constexpr builtins is consistent, the code in `ExprConstant.cpp` (where the actual constant evaluation of builtins is being done) guards it.
If builtin is not marked with `E`, it surely won't be evaluated, and vice versa - if builtin is marked but there is no code for evaluating it, there is a `llvm_unreachable`.
This macro will be needed because we are making constexpr `<cmath>` and `<cstdlib>`. We will conditionally make the functions constexpr until all supported compilers have full support.
We had a discussion where we found out that we need `__has_builtin_constexpr`: https://discourse.llvm.org/t/how-do-we-plan-to-make-constexpr-cmath-and-cstdlib/65930 Please read it if you wonder why we need it =) Thank you for your attention!
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D136036/new/
https://reviews.llvm.org/D136036
More information about the cfe-commits
mailing list