diff options
| author | Richard Smith <richard-llvm@metafoo.co.uk> | 2019-10-08 23:37:49 +0000 |
|---|---|---|
| committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2019-10-08 23:37:49 +0000 |
| commit | 5769440b5c6cbe2e6fd0f7e98c9c4698e4e73ab6 (patch) | |
| tree | 90129f85f376dcb26de962d0eca04a9b8bd323b2 | |
| parent | 8f7a32043d7a5498bf334e222c6beadba6195b24 (diff) | |
| download | bcm5719-llvm-5769440b5c6cbe2e6fd0f7e98c9c4698e4e73ab6.tar.gz bcm5719-llvm-5769440b5c6cbe2e6fd0f7e98c9c4698e4e73ab6.zip | |
Factor out some duplication. NFC.
llvm-svn: 374130
| -rw-r--r-- | clang/lib/AST/ExprConstant.cpp | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/clang/lib/AST/ExprConstant.cpp b/clang/lib/AST/ExprConstant.cpp index 55ed550a1e7..02639679a40 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); } |

