@@ -1734,16 +1734,16 @@ static ConstantEmissionKind checkVarTypeForConstantEmission(QualType type) {
17341734// / for instance if a block or lambda or a member of a local class uses a
17351735// / const int variable or constexpr variable from an enclosing function.
17361736CodeGenFunction::ConstantEmission
1737- CodeGenFunction::tryEmitAsConstant (DeclRefExpr *refExpr ) {
1738- ValueDecl *value = refExpr ->getDecl ();
1737+ CodeGenFunction::tryEmitAsConstant (const DeclRefExpr *RefExpr ) {
1738+ const ValueDecl *Value = RefExpr ->getDecl ();
17391739
17401740 // The value needs to be an enum constant or a constant variable.
17411741 ConstantEmissionKind CEK;
1742- if (isa<ParmVarDecl>(value )) {
1742+ if (isa<ParmVarDecl>(Value )) {
17431743 CEK = CEK_None;
1744- } else if (auto *var = dyn_cast<VarDecl>(value )) {
1744+ } else if (auto *var = dyn_cast<VarDecl>(Value )) {
17451745 CEK = checkVarTypeForConstantEmission (var->getType ());
1746- } else if (isa<EnumConstantDecl>(value )) {
1746+ } else if (isa<EnumConstantDecl>(Value )) {
17471747 CEK = CEK_AsValueOnly;
17481748 } else {
17491749 CEK = CEK_None;
@@ -1756,15 +1756,15 @@ CodeGenFunction::tryEmitAsConstant(DeclRefExpr *refExpr) {
17561756
17571757 // It's best to evaluate all the way as an r-value if that's permitted.
17581758 if (CEK != CEK_AsReferenceOnly &&
1759- refExpr ->EvaluateAsRValue (result, getContext ())) {
1759+ RefExpr ->EvaluateAsRValue (result, getContext ())) {
17601760 resultIsReference = false ;
1761- resultType = refExpr ->getType ().getUnqualifiedType ();
1761+ resultType = RefExpr ->getType ().getUnqualifiedType ();
17621762
17631763 // Otherwise, try to evaluate as an l-value.
17641764 } else if (CEK != CEK_AsValueOnly &&
1765- refExpr ->EvaluateAsLValue (result, getContext ())) {
1765+ RefExpr ->EvaluateAsLValue (result, getContext ())) {
17661766 resultIsReference = true ;
1767- resultType = value ->getType ();
1767+ resultType = Value ->getType ();
17681768
17691769 // Failure.
17701770 } else {
@@ -1783,7 +1783,7 @@ CodeGenFunction::tryEmitAsConstant(DeclRefExpr *refExpr) {
17831783 // accessible on device. The DRE of the captured reference variable has to be
17841784 // loaded from captures.
17851785 if (CGM.getLangOpts ().CUDAIsDevice && result.Val .isLValue () &&
1786- refExpr ->refersToEnclosingVariableOrCapture ()) {
1786+ RefExpr ->refersToEnclosingVariableOrCapture ()) {
17871787 auto *MD = dyn_cast_or_null<CXXMethodDecl>(CurCodeDecl);
17881788 if (MD && MD->getParent ()->isLambda () &&
17891789 MD->getOverloadedOperator () == OO_Call) {
@@ -1799,17 +1799,17 @@ CodeGenFunction::tryEmitAsConstant(DeclRefExpr *refExpr) {
17991799 }
18001800
18011801 // Emit as a constant.
1802- auto C = ConstantEmitter (*this ).emitAbstract (refExpr ->getLocation (),
1802+ auto C = ConstantEmitter (*this ).emitAbstract (RefExpr ->getLocation (),
18031803 result.Val , resultType);
18041804
18051805 // Make sure we emit a debug reference to the global variable.
18061806 // This should probably fire even for
1807- if (isa<VarDecl>(value )) {
1808- if (!getContext ().DeclMustBeEmitted (cast<VarDecl>(value )))
1809- EmitDeclRefExprDbgValue (refExpr , result.Val );
1807+ if (isa<VarDecl>(Value )) {
1808+ if (!getContext ().DeclMustBeEmitted (cast<VarDecl>(Value )))
1809+ EmitDeclRefExprDbgValue (RefExpr , result.Val );
18101810 } else {
1811- assert (isa<EnumConstantDecl>(value ));
1812- EmitDeclRefExprDbgValue (refExpr , result.Val );
1811+ assert (isa<EnumConstantDecl>(Value ));
1812+ EmitDeclRefExprDbgValue (RefExpr , result.Val );
18131813 }
18141814
18151815 // If we emitted a reference constant, we need to dereference that.
@@ -2201,8 +2201,8 @@ RValue CodeGenFunction::EmitLoadOfLValue(LValue LV, SourceLocation Loc) {
22012201 // Load from __ptrauth.
22022202 if (PointerAuthQualifier PtrAuth = LV.getQuals ().getPointerAuth ()) {
22032203 LV.getQuals ().removePointerAuth ();
2204- auto value = EmitLoadOfLValue (LV, Loc).getScalarVal ();
2205- return RValue::get (EmitPointerAuthUnqualify (PtrAuth, value , LV.getType (),
2204+ auto Value = EmitLoadOfLValue (LV, Loc).getScalarVal ();
2205+ return RValue::get (EmitPointerAuthUnqualify (PtrAuth, Value , LV.getType (),
22062206 LV.getAddress (),
22072207 /* known nonnull*/ false ));
22082208 }
@@ -5582,8 +5582,8 @@ CGCallee CodeGenFunction::EmitCallee(const Expr *E) {
55825582 // Try to remember the original __ptrauth qualifier for loads of
55835583 // function pointers.
55845584 if (ICE->getCastKind () == CK_LValueToRValue) {
5585- auto *SubExpr = ICE->getSubExpr ();
5586- if (auto *PtrType = SubExpr->getType ()->getAs <PointerType>()) {
5585+ const auto *SubExpr = ICE->getSubExpr ();
5586+ if (const auto *PtrType = SubExpr->getType ()->getAs <PointerType>()) {
55875587 auto Result = EmitOrigPointerRValue (E);
55885588
55895589 QualType FunctionType = PtrType->getPointeeType ();
0 commit comments