Skip to content

Commit c37a324

Browse files
committed
Early returns
1 parent da94831 commit c37a324

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

clang/lib/AST/ExprConstant.cpp

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5223,16 +5223,16 @@ static bool EvaluateDecompositionDeclInit(EvalInfo &Info,
52235223

52245224
static bool EvaluateDecl(EvalInfo &Info, const Decl *D,
52255225
bool EvaluateConditionDecl) {
5226-
bool OK = true;
5227-
52285226
if (const VarDecl *VD = dyn_cast<VarDecl>(D))
5229-
OK &= EvaluateVarDecl(Info, VD);
5227+
if (!EvaluateVarDecl(Info, VD))
5228+
return false;
52305229

52315230
if (const DecompositionDecl *DD = dyn_cast<DecompositionDecl>(D);
52325231
EvaluateConditionDecl && DD)
5233-
OK &= EvaluateDecompositionDeclInit(Info, DD);
5232+
if (!EvaluateDecompositionDeclInit(Info, DD))
5233+
return false;
52345234

5235-
return OK;
5235+
return true;
52365236
}
52375237

52385238
static bool EvaluateDecompositionDeclInit(EvalInfo &Info,
@@ -5260,7 +5260,8 @@ static bool EvaluateCond(EvalInfo &Info, const VarDecl *CondDecl,
52605260
if (Cond->isValueDependent())
52615261
return false;
52625262
FullExpressionRAII Scope(Info);
5263-
if (CondDecl && !EvaluateDecl(Info, CondDecl, /*EvaluateConditionDecl=*/false))
5263+
if (CondDecl &&
5264+
!EvaluateDecl(Info, CondDecl, /*EvaluateConditionDecl=*/false))
52645265
return false;
52655266
if (!EvaluateAsBooleanCondition(Cond, Result, Info))
52665267
return false;

0 commit comments

Comments
 (0)