[clang] [clang] Implement the __builtin_type_order intrinsic for P2830R10 Constexpr Type Ordering (PR #216462)
Yanzuo Liu via cfe-commits
cfe-commits at lists.llvm.org
Thu Aug 20 05:51:28 PDT 2026
================
@@ -1408,6 +1430,32 @@ static bool EvaluateBooleanTypeTrait(Sema &S, TypeTrait Kind,
return false;
}
+static ExprResult
+EvaluateStrongOrderingTypeTrait(Sema &S, TypeTrait Kind, SourceLocation KWLoc,
+ ArrayRef<TypeSourceInfo *> Args,
+ SourceLocation RParenLoc, bool IsDependent) {
+ QualType StrongOrdering = S.CheckComparisonCategoryType(
+ ComparisonCategoryType::StrongOrdering, KWLoc,
+ Sema::ComparisonCategoryUsage::Builtin);
+ if (StrongOrdering.isNull())
+ return ExprError();
+
+ if (IsDependent)
+ return TypeTraitExpr::Create(S.Context, StrongOrdering, KWLoc, Kind, Args,
+ RParenLoc, APValue());
+
+ switch (Kind) {
+ case clang::BTT_TypeOrder: {
----------------
zwuis wrote:
```cpp
assert(Kind == clang::BTT_TypeOrder && "...")
```
https://github.com/llvm/llvm-project/pull/216462
More information about the cfe-commits
mailing list