@@ -1022,7 +1022,8 @@ bool Compiler<Emitter>::VisitPointerArithBinOp(const BinaryOperator *E) {
10221022 if (classifyPrim (E) != PT_Ptr)
10231023 return this ->emitDecayPtr (PT_Ptr, classifyPrim (E), E);
10241024 return true ;
1025- } else if (Op == BO_Sub) {
1025+ }
1026+ if (Op == BO_Sub) {
10261027 if (!this ->emitSubOffset (OffsetType, E))
10271028 return false ;
10281029
@@ -3703,7 +3704,7 @@ bool Compiler<Emitter>::VisitBlockExpr(const BlockExpr *E) {
37033704 return true ;
37043705
37053706 const Function *Func = nullptr ;
3706- if (auto F = Ctx.getOrCreateObjCBlock (E))
3707+ if (const Function * F = Ctx.getOrCreateObjCBlock (E))
37073708 Func = F;
37083709
37093710 if (!Func)
@@ -4288,7 +4289,8 @@ bool Compiler<Emitter>::visitZeroArrayInitializer(QualType T, const Expr *E) {
42884289 return false ;
42894290 }
42904291 return true ;
4291- } else if (ElemType->isRecordType ()) {
4292+ }
4293+ if (ElemType->isRecordType ()) {
42924294 const Record *R = getRecord (ElemType);
42934295
42944296 for (size_t I = 0 ; I != NumElems; ++I) {
@@ -4302,7 +4304,8 @@ bool Compiler<Emitter>::visitZeroArrayInitializer(QualType T, const Expr *E) {
43024304 return false ;
43034305 }
43044306 return true ;
4305- } else if (ElemType->isArrayType ()) {
4307+ }
4308+ if (ElemType->isArrayType ()) {
43064309 for (size_t I = 0 ; I != NumElems; ++I) {
43074310 if (!this ->emitConstUint32 (I, E))
43084311 return false ;
@@ -4774,11 +4777,10 @@ VarCreationState Compiler<Emitter>::visitVarDecl(const VarDecl *VD,
47744777 if (!this ->visit (Init))
47754778 return false ;
47764779 return this ->emitSetLocal (*VarT, Offset, VD) && Scope.destroyLocals ();
4777- } else {
4780+ }
47784781 if (!this ->visit (Init))
47794782 return false ;
47804783 return this ->emitSetLocal (*VarT, Offset, VD);
4781- }
47824784 }
47834785 } else {
47844786 if (std::optional<unsigned > Offset = this ->allocateLocal (
@@ -4805,7 +4807,7 @@ bool Compiler<Emitter>::visitAPValue(const APValue &Val, PrimType ValType,
48054807 assert (!DiscardResult);
48064808 if (Val.isInt ())
48074809 return this ->emitConst (Val.getInt (), ValType, E);
4808- else if (Val.isFloat ()) {
4810+ if (Val.isFloat ()) {
48094811 APFloat F = Val.getFloat ();
48104812 return this ->emitFloat (F, E);
48114813 }
@@ -4816,9 +4818,8 @@ bool Compiler<Emitter>::visitAPValue(const APValue &Val, PrimType ValType,
48164818 APValue::LValueBase Base = Val.getLValueBase ();
48174819 if (const Expr *BaseExpr = Base.dyn_cast <const Expr *>())
48184820 return this ->visit (BaseExpr);
4819- else if (const auto *VD = Base.dyn_cast <const ValueDecl *>()) {
4821+ if (const auto *VD = Base.dyn_cast <const ValueDecl *>())
48204822 return this ->visitDeclRef (VD, E);
4821- }
48224823 } else if (Val.isMemberPointer ()) {
48234824 if (const ValueDecl *MemberDecl = Val.getMemberPointerDecl ())
48244825 return this ->emitGetMemberPtr (MemberDecl, E);
@@ -4854,7 +4855,8 @@ bool Compiler<Emitter>::visitAPValueInitializer(const APValue &Val,
48544855 }
48554856 }
48564857 return true ;
4857- } else if (Val.isUnion ()) {
4858+ }
4859+ if (Val.isUnion ()) {
48584860 const FieldDecl *UnionField = Val.getUnionField ();
48594861 const Record *R = this ->getRecord (UnionField->getParent ());
48604862 assert (R);
@@ -4864,7 +4866,8 @@ bool Compiler<Emitter>::visitAPValueInitializer(const APValue &Val,
48644866 if (!this ->visitAPValue (F, T, E))
48654867 return false ;
48664868 return this ->emitInitField (T, RF->Offset , E);
4867- } else if (Val.isArray ()) {
4869+ }
4870+ if (Val.isArray ()) {
48684871 const auto *ArrType = T->getAsArrayTypeUnsafe ();
48694872 QualType ElemType = ArrType->getElementType ();
48704873 for (unsigned A = 0 , AN = Val.getArraySize (); A != AN; ++A) {
@@ -4981,12 +4984,10 @@ bool Compiler<Emitter>::VisitCallExpr(const CallExpr *E) {
49814984
49824985 // Calls to replaceable operator new/operator delete.
49834986 if (FuncDecl->isUsableAsGlobalAllocationFunctionInConstantEvaluation ()) {
4984- if (FuncDecl->getDeclName ().isAnyOperatorNew ()) {
4987+ if (FuncDecl->getDeclName ().isAnyOperatorNew ())
49854988 return VisitBuiltinCallExpr (E, Builtin::BI__builtin_operator_new);
4986- } else {
4987- assert (FuncDecl->getDeclName ().getCXXOverloadedOperator () == OO_Delete);
4988- return VisitBuiltinCallExpr (E, Builtin::BI__builtin_operator_delete);
4989- }
4989+ assert (FuncDecl->getDeclName ().getCXXOverloadedOperator () == OO_Delete);
4990+ return VisitBuiltinCallExpr (E, Builtin::BI__builtin_operator_delete);
49904991 }
49914992
49924993 // Explicit calls to trivial destructors
@@ -5455,7 +5456,9 @@ bool Compiler<Emitter>::visitReturnStmt(const ReturnStmt *RS) {
54555456 return false ;
54565457 this ->emitCleanup ();
54575458 return this ->emitRet (*ReturnType, RS);
5458- } else if (RE->getType ()->isVoidType ()) {
5459+ }
5460+
5461+ if (RE->getType ()->isVoidType ()) {
54595462 if (!this ->visit (RE))
54605463 return false ;
54615464 } else {
@@ -5500,7 +5503,7 @@ template <class Emitter> bool Compiler<Emitter>::visitIfStmt(const IfStmt *IS) {
55005503 if (std::optional<bool > BoolValue = getBoolValue (IS->getCond ())) {
55015504 if (*BoolValue)
55025505 return visitChildStmt (IS->getThen ());
5503- else if (const Stmt *Else = IS->getElse ())
5506+ if (const Stmt *Else = IS->getElse ())
55045507 return visitChildStmt (Else);
55055508 return true ;
55065509 }
@@ -5992,7 +5995,7 @@ bool Compiler<Emitter>::compileConstructor(const CXXConstructorDecl *Ctor) {
59925995 if (!this ->emitThis (Ctor))
59935996 return false ;
59945997
5995- auto PVD = Ctor->getParamDecl (0 );
5998+ const ParmVarDecl * PVD = Ctor->getParamDecl (0 );
59965999 ParamOffset PO = this ->Params [PVD]; // Must exist.
59976000
59986001 if (!this ->emitGetParam (PT_Ptr, PO.Offset , Ctor))
@@ -6153,7 +6156,7 @@ bool Compiler<Emitter>::compileUnionAssignmentOperator(
61536156 if (!this ->emitThis (MD))
61546157 return false ;
61556158
6156- auto PVD = MD->getParamDecl (0 );
6159+ const ParmVarDecl * PVD = MD->getParamDecl (0 );
61576160 ParamOffset PO = this ->Params [PVD]; // Must exist.
61586161
61596162 if (!this ->emitGetParam (PT_Ptr, PO.Offset , MD))
0 commit comments