From e91e0f52895e2b23bd690a86dbaafd979e027d29 Mon Sep 17 00:00:00 2001 From: Jessica Clarke Date: Fri, 9 Aug 2024 22:52:08 +0100 Subject: [PATCH] [CodeGen][NFCI] Don't re-implement parts of ASTContext::getIntWidth (#101765) ASTContext::getIntWidth returns 1 if isBooleanType(), and falls back on getTypeSize in the default case, which itself just returns the Width from getTypeInfo's returned struct, so can be used in all cases here, not just for _BitInt types. --- clang/lib/CodeGen/CGBuiltin.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/clang/lib/CodeGen/CGBuiltin.cpp b/clang/lib/CodeGen/CGBuiltin.cpp index d1af7fde157b64..7fe80b0cbdfbfa 100644 --- a/clang/lib/CodeGen/CGBuiltin.cpp +++ b/clang/lib/CodeGen/CGBuiltin.cpp @@ -756,9 +756,7 @@ static WidthAndSignedness getIntegerWidthAndSignedness(const clang::ASTContext &context, const clang::QualType Type) { assert(Type->isIntegerType() && "Given type is not an integer."); - unsigned Width = Type->isBooleanType() ? 1 - : Type->isBitIntType() ? context.getIntWidth(Type) - : context.getTypeInfo(Type).Width; + unsigned Width = context.getIntWidth(Type); bool Signed = Type->isSignedIntegerType(); return {Width, Signed}; }