[clang] [Clang][RFC] Intrododuce a builtin to determine the structure binding size (PR #131515)

Erich Keane via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 17 10:30:28 PDT 2025


================
@@ -12102,7 +12102,12 @@ class IntExprEvaluator
   }
 
   bool VisitTypeTraitExpr(const TypeTraitExpr *E) {
-    return Success(E->getValue(), E);
+    if (E->isStoredAsBoolean())
+      return Success(E->getBoolValue(), E);
+    if (E->getAPValue().isAbsent())
+      return false;
+    assert(E->getAPValue().isInt() && "APValue type not supported");
----------------
erichkeane wrote:

would be nice to sprinkle this assert for `isInt` in a few other places so that the next person to try to use a non-bool type trait can get this assert without trying to do constant evaluation (say in the constructor?).

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


More information about the cfe-commits mailing list