From: Richard Smith Date: Tue, 8 Oct 2019 23:37:49 +0000 (+0000) Subject: Factor out some duplication. NFC. X-Git-Tag: llvmorg-11-init~7135 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=5769440b5c6cbe2e6fd0f7e98c9c4698e4e73ab6;p=platform%2Fupstream%2Fllvm.git Factor out some duplication. NFC. llvm-svn: 374130 --- diff --git a/clang/lib/AST/ExprConstant.cpp b/clang/lib/AST/ExprConstant.cpp index 55ed550..0263967 100644 --- a/clang/lib/AST/ExprConstant.cpp +++ b/clang/lib/AST/ExprConstant.cpp @@ -137,7 +137,7 @@ namespace { /// Given an expression, determine the type used to store the result of /// evaluating that expression. - static QualType getStorageType(ASTContext &Ctx, Expr *E) { + static QualType getStorageType(const ASTContext &Ctx, const Expr *E) { if (E->isRValue()) return E->getType(); return Ctx.getLValueReferenceType(E->getType()); @@ -13569,10 +13569,8 @@ bool Expr::EvaluateAsConstantExpr(EvalResult &Result, ConstExprUsage Usage, if (!Info.discardCleanups()) llvm_unreachable("Unhandled cleanup; missing full expression marker?"); - QualType T = getType(); - if (!isRValue()) - T = Ctx.getLValueReferenceType(T); - return CheckConstantExpression(Info, getExprLoc(), T, Result.Val, Usage) && + return CheckConstantExpression(Info, getExprLoc(), getStorageType(Ctx, this), + Result.Val, Usage) && CheckMemoryLeaks(Info); }