[clang] [Clang] Introduce OverflowBehaviorType for fine-grained overflow control (PR #148914)

Matheus Izvekov via cfe-commits cfe-commits at lists.llvm.org
Fri Aug 22 19:56:23 PDT 2025


================
@@ -8914,6 +8975,12 @@ inline bool Type::isIntegerType() const {
     return IsEnumDeclComplete(ET->getOriginalDecl()) &&
            !IsEnumDeclScoped(ET->getOriginalDecl());
   }
+
+  if (isOverflowBehaviorType())
+    return cast<OverflowBehaviorType>(CanonicalType)
+        ->getUnderlyingType()
+        ->isIntegerType();
----------------
mizvekov wrote:

Nit: If you have to test and cast, might as well just dyn_cast.
```suggestion
  if (const auto *OT = dyn_cast<OverflowBehaviorType>(CanonicalType))
    return OT->getUnderlyingType()->isIntegerType();
```

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


More information about the cfe-commits mailing list