Author: rsmith Date: Tue Oct 8 16:37:49 2019 New Revision: 374130 URL: http://llvm.org/viewvc/llvm-project?rev=374130&view=rev Log: Factor out some duplication. NFC.
Modified: cfe/trunk/lib/AST/ExprConstant.cpp Modified: cfe/trunk/lib/AST/ExprConstant.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ExprConstant.cpp?rev=374130&r1=374129&r2=374130&view=diff ============================================================================== --- cfe/trunk/lib/AST/ExprConstant.cpp (original) +++ cfe/trunk/lib/AST/ExprConstant.cpp Tue Oct 8 16:37:49 2019 @@ -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(EvalRe 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); } _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits