[clang] [CIR] Add binary operators (PR #132420)
Andy Kaylor via cfe-commits
cfe-commits at lists.llvm.org
Tue Mar 25 12:06:06 PDT 2025
================
@@ -168,24 +168,9 @@ static bool MustVisitNullValue(const Expr *E) {
return E->getType()->isNullPtrType();
}
-/// If \p E is a widened promoted integer, get its base (unpromoted) type.
-static std::optional<QualType> getUnwidenedIntegerType(const ASTContext &Ctx,
- const Expr *E) {
- const Expr *Base = E->IgnoreImpCasts();
- if (E == Base)
- return std::nullopt;
-
- QualType BaseTy = Base->getType();
- if (!Ctx.isPromotableIntegerType(BaseTy) ||
- Ctx.getTypeSize(BaseTy) >= Ctx.getTypeSize(E->getType()))
- return std::nullopt;
-
- return BaseTy;
-}
-
/// Check if \p E is a widened promoted integer.
static bool IsWidenedIntegerOp(const ASTContext &Ctx, const Expr *E) {
- return getUnwidenedIntegerType(Ctx, E).has_value();
+ return Ctx.getUnwidenedIntegerType(E).has_value();
----------------
andykaylor wrote:
I love this change, but this should probably be split out as a separate patch. As we discussed earlier, let's defer this refactoring for a separate patch.
https://github.com/llvm/llvm-project/pull/132420
More information about the cfe-commits
mailing list