[clang] [clang][analyzer] Correct SMT Layer for _BitInt cases refutations (PR #143310)
Donát Nagy via cfe-commits
cfe-commits at lists.llvm.org
Wed Jun 11 04:51:20 PDT 2025
================
@@ -570,23 +572,35 @@ class SMTConv {
// TODO: Refactor to put elsewhere
static inline QualType getAPSIntType(ASTContext &Ctx,
const llvm::APSInt &Int) {
- return Ctx.getIntTypeForBitwidth(Int.getBitWidth(), Int.isSigned());
+ QualType Ty;
+ if (!(Ty = Ctx.getIntTypeForBitwidth(Int.getBitWidth(), Int.isSigned()))
+ .isNull())
+ return Ty;
+ // If Ty is Null, could be because the original type was a _BitInt.
+ // Get the bit size and round up to next power of 2, max char size
----------------
NagyDonat wrote:
```suggestion
// Get the size of the _BitInt type (expressed in bits) and round it up to
// the next power of 2 that is at least the bit size of 'char' (usually 8).
```
For a moment I was very confused by this comment, because I thought that "max char size" means that for some reason the value is limited _from above_ by 256 (the "char size" in a different sense). I tried to clarify the comment in a suggestion – but feel free to tweak it if you want.
https://github.com/llvm/llvm-project/pull/143310
More information about the cfe-commits
mailing list