Skip to content

Commit b30617b

Browse files
committed
Try fix the failed tests on Windows
1 parent f340426 commit b30617b

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

clang/lib/StaticAnalyzer/Checkers/MallocChecker.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1250,7 +1250,7 @@ SVal MallocChecker::evalMulForBufferSize(CheckerContext &C, const Expr *Blocks,
12501250
SVal BlockBytesVal = C.getSVal(BlockBytes);
12511251
ProgramStateRef State = C.getState();
12521252
SVal TotalSize = SB.evalBinOp(State, BO_Mul, BlocksVal, BlockBytesVal,
1253-
SB.getContext().getSizeType());
1253+
SB.getContext().getCanonicalSizeType());
12541254
return TotalSize;
12551255
}
12561256

@@ -1284,7 +1284,7 @@ static bool isStandardRealloc(const CallEvent &Call) {
12841284
return FD->getDeclaredReturnType().getDesugaredType(AC) == AC.VoidPtrTy &&
12851285
FD->getParamDecl(0)->getType().getDesugaredType(AC) == AC.VoidPtrTy &&
12861286
FD->getParamDecl(1)->getType().getDesugaredType(AC) ==
1287-
AC.getSizeType();
1287+
AC.getCanonicalSizeType();
12881288
}
12891289

12901290
static bool isGRealloc(const CallEvent &Call) {
@@ -1908,7 +1908,7 @@ void MallocChecker::checkTaintedness(CheckerContext &C, const CallEvent &Call,
19081908
return;
19091909

19101910
SValBuilder &SVB = C.getSValBuilder();
1911-
QualType SizeTy = SVB.getContext().getSizeType();
1911+
QualType SizeTy = SVB.getContext().getCanonicalSizeType();
19121912
QualType CmpTy = SVB.getConditionType();
19131913
// In case the symbol is tainted, we give a warning if the
19141914
// size is larger than SIZE_MAX/4
@@ -2884,10 +2884,10 @@ MallocChecker::ReallocMemAux(CheckerContext &C, const CallEvent &Call,
28842884
return nullptr;
28852885

28862886
// Compare the size argument to 0.
2887-
DefinedOrUnknownSVal SizeZero =
2888-
svalBuilder.evalEQ(State, TotalSize.castAs<DefinedOrUnknownSVal>(),
2889-
svalBuilder.makeIntValWithWidth(
2890-
svalBuilder.getContext().getSizeType(), 0));
2887+
DefinedOrUnknownSVal SizeZero = svalBuilder.evalEQ(
2888+
State, TotalSize.castAs<DefinedOrUnknownSVal>(),
2889+
svalBuilder.makeIntValWithWidth(
2890+
svalBuilder.getContext().getCanonicalSizeType(), 0));
28912891

28922892
ProgramStateRef StatePtrIsNull, StatePtrNotNull;
28932893
std::tie(StatePtrIsNull, StatePtrNotNull) = State->assume(PtrEQ);

0 commit comments

Comments
 (0)