[clang] [clang][analyzer] Correct SMT Layer for _BitInt cases refutations (PR #143310)

Balazs Benics via cfe-commits cfe-commits at lists.llvm.org
Wed Jun 11 06:20:38 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())
----------------
steakhal wrote:

Alright then. Then at least move the initializer out of the if condition, because objectively assignments within conditions are uncommon. And if we are there we could make `Ty` const to at least imply that we won't mutate this afterwards.

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


More information about the cfe-commits mailing list