Skip to content

Commit 727c5e8

Browse files
committed
replace if by assert
1 parent 1301349 commit 727c5e8

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

clang/lib/StaticAnalyzer/Core/SValBuilder.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -370,9 +370,8 @@ std::optional<SVal> SValBuilder::getConstantVal(const Expr *E) {
370370
const auto *TE = cast<TypeTraitExpr>(E);
371371
if (TE->isStoredAsBoolean())
372372
return makeTruthVal(TE->getBoolValue(), TE->getType());
373-
if (TE->getType()->isIntegralOrEnumerationType())
374-
return makeIntVal(TE->getAPValue().getInt());
375-
return std::nullopt;
373+
assert(TE->getAPValue().isInt() && "APValue type not supported");
374+
return makeIntVal(TE->getAPValue().getInt());
376375
}
377376

378377
case Stmt::IntegerLiteralClass:

0 commit comments

Comments
 (0)