Skip to content

Commit 8b2238f

Browse files
author
einvbri
committed
[clang][analyzer] Correct SMT Layer for _BitInt cases refutations
Correct clang-format issues
1 parent 4b86a56 commit 8b2238f

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

clang/include/clang/StaticAnalyzer/Core/PathSensitive/SMTConv.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -574,7 +574,7 @@ class SMTConv {
574574
}
575575

576576
static inline bool IsPower2(unsigned bits) {
577-
return bits > 0 && (bits & (bits-1)) == 0;
577+
return bits > 0 && (bits & (bits - 1)) == 0;
578578
}
579579

580580
// Get the QualTy for the input APSInt, and fix it if it has a bitwidth of 1.
@@ -590,9 +590,9 @@ class SMTConv {
590590
if (APSIntBitwidth == 1 && Ty.isNull()) {
591591
NewInt = Int.extend(Ctx.getTypeSize(Ctx.BoolTy));
592592
Ty = getAPSIntType(Ctx, NewInt);
593-
} else if ( !IsPower2(APSIntBitwidth) && !getAPSIntType(Ctx, Int).isNull()) {
593+
} else if (!IsPower2(APSIntBitwidth) && !getAPSIntType(Ctx, Int).isNull()) {
594594
Ty = getAPSIntType(Ctx, Int);
595-
NewInt = Int.extend( Ctx.getTypeSize(Ty));
595+
NewInt = Int.extend(Ctx.getTypeSize(Ty));
596596
} else
597597
NewInt = Int;
598598

clang/lib/AST/ASTContext.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13211,10 +13211,12 @@ QualType ASTContext::getIntTypeForBitwidth(unsigned DestWidth,
1321113211
unsigned Signed) const {
1321213212
// round up to next power of 2 for _BitInt cases
1321313213
unsigned pow2DestWidth = llvm::bit_ceil(DestWidth);
13214-
//if (pow2DestWidth == 4) pow2DestWidth = 8;
13215-
if (pow2DestWidth < 8) pow2DestWidth = 8;
13214+
// if (pow2DestWidth == 4) pow2DestWidth = 8;
13215+
if (pow2DestWidth < 8)
13216+
pow2DestWidth = 8;
1321613217

13217-
TargetInfo::IntType Ty = getTargetInfo().getIntTypeByWidth(pow2DestWidth, Signed);
13218+
TargetInfo::IntType Ty =
13219+
getTargetInfo().getIntTypeByWidth(pow2DestWidth, Signed);
1321813220
CanQualType QualTy = getFromTargetType(Ty);
1321913221
if (!QualTy && pow2DestWidth == 128)
1322013222
return Signed ? Int128Ty : UnsignedInt128Ty;

0 commit comments

Comments
 (0)