diff --git a/clang/lib/AST/ExprConstant.cpp b/clang/lib/AST/ExprConstant.cpp index bb5ab67328fbc..fa0661f65fcea 100644 --- a/clang/lib/AST/ExprConstant.cpp +++ b/clang/lib/AST/ExprConstant.cpp @@ -16473,7 +16473,7 @@ static bool FastEvaluateAsRValue(const Expr *Exp, Expr::EvalResult &Result, const ASTContext &Ctx, bool &IsConst) { // Fast-path evaluations of integer literals, since we sometimes see files // containing vast quantities of these. - if (const IntegerLiteral *L = dyn_cast(Exp)) { + if (const auto *L = dyn_cast(Exp)) { Result.Val = APValue(APSInt(L->getValue(), L->getType()->isUnsignedIntegerType())); IsConst = true; @@ -16486,6 +16486,18 @@ static bool FastEvaluateAsRValue(const Expr *Exp, Expr::EvalResult &Result, return true; } + if (const auto *FL = dyn_cast(Exp)) { + Result.Val = APValue(FL->getValue()); + IsConst = true; + return true; + } + + if (const auto *L = dyn_cast(Exp)) { + Result.Val = APValue(Ctx.MakeIntValue(L->getValue(), L->getType())); + IsConst = true; + return true; + } + if (const auto *CE = dyn_cast(Exp)) { if (CE->hasAPValueResult()) { APValue APV = CE->getAPValueResult();