@@ -8951,39 +8951,39 @@ static bool EvaluateLValue(const Expr *E, LValue &Result, EvalInfo &Info,
89518951}
89528952
89538953bool LValueExprEvaluator::VisitDeclRefExpr(const DeclRefExpr *E) {
8954- const NamedDecl *D = E->getDecl();
8955- if (isa<FunctionDecl, MSGuidDecl, TemplateParamObjectDecl,
8956- UnnamedGlobalConstantDecl>(D))
8957- return Success(cast<ValueDecl>(D));
8958- if (const VarDecl *VD = dyn_cast<VarDecl>(D))
8959- return VisitVarDecl(E, VD);
8960- if (const BindingDecl *BD = dyn_cast<BindingDecl>(D))
8961- return Visit(BD->getBinding());
8962- return Error(E);
8963- }
8954+ const ValueDecl *D = E->getDecl();
89648955
8965- bool LValueExprEvaluator::VisitVarDecl(const Expr *E, const VarDecl *VD) {
89668956 // If we are within a lambda's call operator, check whether the 'VD' referred
89678957 // to within 'E' actually represents a lambda-capture that maps to a
89688958 // data-member/field within the closure object, and if so, evaluate to the
89698959 // field or what the field refers to.
89708960 if (Info.CurrentCall && isLambdaCallOperator(Info.CurrentCall->Callee) &&
8971- isa<DeclRefExpr>(E) &&
8972- cast<DeclRefExpr>(E)->refersToEnclosingVariableOrCapture()) {
8961+ E->refersToEnclosingVariableOrCapture()) {
89738962 // We don't always have a complete capture-map when checking or inferring if
89748963 // the function call operator meets the requirements of a constexpr function
89758964 // - but we don't need to evaluate the captures to determine constexprness
89768965 // (dcl.constexpr C++17).
89778966 if (Info.checkingPotentialConstantExpression())
89788967 return false;
89798968
8980- if (auto *FD = Info.CurrentCall->LambdaCaptureFields.lookup(VD )) {
8969+ if (auto *FD = Info.CurrentCall->LambdaCaptureFields.lookup(D )) {
89818970 const auto *MD = cast<CXXMethodDecl>(Info.CurrentCall->Callee);
89828971 return HandleLambdaCapture(Info, E, Result, MD, FD,
89838972 FD->getType()->isReferenceType());
89848973 }
89858974 }
89868975
8976+ if (isa<FunctionDecl, MSGuidDecl, TemplateParamObjectDecl,
8977+ UnnamedGlobalConstantDecl>(D))
8978+ return Success(cast<ValueDecl>(D));
8979+ if (const VarDecl *VD = dyn_cast<VarDecl>(D))
8980+ return VisitVarDecl(E, VD);
8981+ if (const BindingDecl *BD = dyn_cast<BindingDecl>(D))
8982+ return Visit(BD->getBinding());
8983+ return Error(E);
8984+ }
8985+
8986+ bool LValueExprEvaluator::VisitVarDecl(const Expr *E, const VarDecl *VD) {
89878987 CallStackFrame *Frame = nullptr;
89888988 unsigned Version = 0;
89898989 if (VD->hasLocalStorage()) {
0 commit comments