@@ -1022,7 +1022,8 @@ bool Compiler<Emitter>::VisitPointerArithBinOp(const BinaryOperator *E) {
1022
1022
if (classifyPrim (E) != PT_Ptr)
1023
1023
return this ->emitDecayPtr (PT_Ptr, classifyPrim (E), E);
1024
1024
return true ;
1025
- } else if (Op == BO_Sub) {
1025
+ }
1026
+ if (Op == BO_Sub) {
1026
1027
if (!this ->emitSubOffset (OffsetType, E))
1027
1028
return false ;
1028
1029
@@ -3703,7 +3704,7 @@ bool Compiler<Emitter>::VisitBlockExpr(const BlockExpr *E) {
3703
3704
return true ;
3704
3705
3705
3706
const Function *Func = nullptr ;
3706
- if (auto F = Ctx.getOrCreateObjCBlock (E))
3707
+ if (const Function * F = Ctx.getOrCreateObjCBlock (E))
3707
3708
Func = F;
3708
3709
3709
3710
if (!Func)
@@ -4288,7 +4289,8 @@ bool Compiler<Emitter>::visitZeroArrayInitializer(QualType T, const Expr *E) {
4288
4289
return false ;
4289
4290
}
4290
4291
return true ;
4291
- } else if (ElemType->isRecordType ()) {
4292
+ }
4293
+ if (ElemType->isRecordType ()) {
4292
4294
const Record *R = getRecord (ElemType);
4293
4295
4294
4296
for (size_t I = 0 ; I != NumElems; ++I) {
@@ -4302,7 +4304,8 @@ bool Compiler<Emitter>::visitZeroArrayInitializer(QualType T, const Expr *E) {
4302
4304
return false ;
4303
4305
}
4304
4306
return true ;
4305
- } else if (ElemType->isArrayType ()) {
4307
+ }
4308
+ if (ElemType->isArrayType ()) {
4306
4309
for (size_t I = 0 ; I != NumElems; ++I) {
4307
4310
if (!this ->emitConstUint32 (I, E))
4308
4311
return false ;
@@ -4774,11 +4777,10 @@ VarCreationState Compiler<Emitter>::visitVarDecl(const VarDecl *VD,
4774
4777
if (!this ->visit (Init))
4775
4778
return false ;
4776
4779
return this ->emitSetLocal (*VarT, Offset, VD) && Scope.destroyLocals ();
4777
- } else {
4780
+ }
4778
4781
if (!this ->visit (Init))
4779
4782
return false ;
4780
4783
return this ->emitSetLocal (*VarT, Offset, VD);
4781
- }
4782
4784
}
4783
4785
} else {
4784
4786
if (std::optional<unsigned > Offset = this ->allocateLocal (
@@ -4805,7 +4807,7 @@ bool Compiler<Emitter>::visitAPValue(const APValue &Val, PrimType ValType,
4805
4807
assert (!DiscardResult);
4806
4808
if (Val.isInt ())
4807
4809
return this ->emitConst (Val.getInt (), ValType, E);
4808
- else if (Val.isFloat ()) {
4810
+ if (Val.isFloat ()) {
4809
4811
APFloat F = Val.getFloat ();
4810
4812
return this ->emitFloat (F, E);
4811
4813
}
@@ -4816,9 +4818,8 @@ bool Compiler<Emitter>::visitAPValue(const APValue &Val, PrimType ValType,
4816
4818
APValue::LValueBase Base = Val.getLValueBase ();
4817
4819
if (const Expr *BaseExpr = Base.dyn_cast <const Expr *>())
4818
4820
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 *>())
4820
4822
return this ->visitDeclRef (VD, E);
4821
- }
4822
4823
} else if (Val.isMemberPointer ()) {
4823
4824
if (const ValueDecl *MemberDecl = Val.getMemberPointerDecl ())
4824
4825
return this ->emitGetMemberPtr (MemberDecl, E);
@@ -4854,7 +4855,8 @@ bool Compiler<Emitter>::visitAPValueInitializer(const APValue &Val,
4854
4855
}
4855
4856
}
4856
4857
return true ;
4857
- } else if (Val.isUnion ()) {
4858
+ }
4859
+ if (Val.isUnion ()) {
4858
4860
const FieldDecl *UnionField = Val.getUnionField ();
4859
4861
const Record *R = this ->getRecord (UnionField->getParent ());
4860
4862
assert (R);
@@ -4864,7 +4866,8 @@ bool Compiler<Emitter>::visitAPValueInitializer(const APValue &Val,
4864
4866
if (!this ->visitAPValue (F, T, E))
4865
4867
return false ;
4866
4868
return this ->emitInitField (T, RF->Offset , E);
4867
- } else if (Val.isArray ()) {
4869
+ }
4870
+ if (Val.isArray ()) {
4868
4871
const auto *ArrType = T->getAsArrayTypeUnsafe ();
4869
4872
QualType ElemType = ArrType->getElementType ();
4870
4873
for (unsigned A = 0 , AN = Val.getArraySize (); A != AN; ++A) {
@@ -4981,12 +4984,10 @@ bool Compiler<Emitter>::VisitCallExpr(const CallExpr *E) {
4981
4984
4982
4985
// Calls to replaceable operator new/operator delete.
4983
4986
if (FuncDecl->isUsableAsGlobalAllocationFunctionInConstantEvaluation ()) {
4984
- if (FuncDecl->getDeclName ().isAnyOperatorNew ()) {
4987
+ if (FuncDecl->getDeclName ().isAnyOperatorNew ())
4985
4988
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);
4990
4991
}
4991
4992
4992
4993
// Explicit calls to trivial destructors
@@ -5455,7 +5456,9 @@ bool Compiler<Emitter>::visitReturnStmt(const ReturnStmt *RS) {
5455
5456
return false ;
5456
5457
this ->emitCleanup ();
5457
5458
return this ->emitRet (*ReturnType, RS);
5458
- } else if (RE->getType ()->isVoidType ()) {
5459
+ }
5460
+
5461
+ if (RE->getType ()->isVoidType ()) {
5459
5462
if (!this ->visit (RE))
5460
5463
return false ;
5461
5464
} else {
@@ -5500,7 +5503,7 @@ template <class Emitter> bool Compiler<Emitter>::visitIfStmt(const IfStmt *IS) {
5500
5503
if (std::optional<bool > BoolValue = getBoolValue (IS->getCond ())) {
5501
5504
if (*BoolValue)
5502
5505
return visitChildStmt (IS->getThen ());
5503
- else if (const Stmt *Else = IS->getElse ())
5506
+ if (const Stmt *Else = IS->getElse ())
5504
5507
return visitChildStmt (Else);
5505
5508
return true ;
5506
5509
}
@@ -5992,7 +5995,7 @@ bool Compiler<Emitter>::compileConstructor(const CXXConstructorDecl *Ctor) {
5992
5995
if (!this ->emitThis (Ctor))
5993
5996
return false ;
5994
5997
5995
- auto PVD = Ctor->getParamDecl (0 );
5998
+ const ParmVarDecl * PVD = Ctor->getParamDecl (0 );
5996
5999
ParamOffset PO = this ->Params [PVD]; // Must exist.
5997
6000
5998
6001
if (!this ->emitGetParam (PT_Ptr, PO.Offset , Ctor))
@@ -6153,7 +6156,7 @@ bool Compiler<Emitter>::compileUnionAssignmentOperator(
6153
6156
if (!this ->emitThis (MD))
6154
6157
return false ;
6155
6158
6156
- auto PVD = MD->getParamDecl (0 );
6159
+ const ParmVarDecl * PVD = MD->getParamDecl (0 );
6157
6160
ParamOffset PO = this ->Params [PVD]; // Must exist.
6158
6161
6159
6162
if (!this ->emitGetParam (PT_Ptr, PO.Offset , MD))
0 commit comments