Skip to content

Commit

Permalink
[CodeGen][NFCI] Don't re-implement parts of ASTContext::getIntWidth (#…
Browse files Browse the repository at this point in the history
…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.
  • Loading branch information
jrtc27 authored Aug 9, 2024
1 parent f7ad495 commit e91e0f5
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions clang/lib/CodeGen/CGBuiltin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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};
}
Expand Down

0 comments on commit e91e0f5

Please sign in to comment.