[clang] [AST][NFC] Rename and refactor floating-point status checks in AST and ByteCode evaluators (PR #213750)

Hubert Tong via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 6 06:23:44 PDT 2026


================
@@ -246,9 +246,26 @@ bool CheckDivRem(InterpState &S, CodePtr OpPC, const T &LHS, const T &RHS) {
 
 /// Checks if the result of a floating-point operation is valid
 /// in the current context.
+/// Notes:
+///   - CheckFloatStatus is the same as
+///     checkFloatingPointResultForConstantFolding in
+///     clang/lib/AST/ExprConstant.cpp.
+///   - CheckFloatResult will also check if the result is NaN, in addition to
+///     CheckFloatStatus's checks.
+// FIXME: P3899R3 (adopted by WG21 in June 2026) likely makes this interface
+// obsolete.
+// https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2026/p3899r3.html
+// Also see the comment:
+// https://github.com/llvm/llvm-project/pull/213750/changes/2fea01449764e23b84ce6790bc7121d369546192#r3708712572
 bool CheckFloatResult(InterpState &S, CodePtr OpPC, const Floating &Result,
                       APFloat::opStatus Status, FPOptions FPO);
 
+/// Check if the given floating-point evaluation status is allowed for
+/// compile-time constant folding during translation (as opposed to mandatory
+/// constant expression evaluation).
+bool CheckFloatStatus(InterpState &S, CodePtr OpPC, APFloat::opStatus Status,
----------------
hubert-reinterpretcast wrote:

> So `CheckFloatStatus` isn't used anywhere except in `CheckFloatResult`? If so, this should go away and the function should be `static`.

`CheckFloatStatus` is new. IMO, it has a place in the future, whereas `CheckFloatResult`'s existence and usage is in question.

https://github.com/llvm/llvm-project/pull/213750


More information about the cfe-commits mailing list