[clang] [CodeGen][NFCI] Don't re-implement parts of ASTContext::getIntWidth (PR #101765)

Alexander Richardson via cfe-commits cfe-commits at lists.llvm.org
Tue Aug 6 12:50:08 PDT 2024


arichardson wrote:

I just had another look at ASTContext::getIntWidth() and the logic there results in the same value being returned, so this should be a NFC change.

```
unsigned ASTContext::getIntWidth(QualType T) const {
  if (const auto *ET = T->getAs<EnumType>())
    T = ET->getDecl()->getIntegerType();
  if (T->isBooleanType())
    return 1;
  if (const auto *EIT = T->getAs<BitIntType>())
    return EIT->getNumBits();
  // For builtin types, just use the standard type sizing method
  return (unsigned)getTypeSize(T);
}
```

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


More information about the cfe-commits mailing list