Skip to content

Commit d558aeb

Browse files
authored
Merge pull request #18382 from gregheo/equatable-conformance-guard-cleanup
[Sema] Clean up comments and SmallVector capacity for derived Equatable conformance
2 parents 6a0f578 + 2a22c08 commit d558aeb

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

lib/Sema/DerivedConformanceEquatableHashable.cpp

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -260,20 +260,19 @@ static DeclRefExpr *convertEnumToIndex(SmallVectorImpl<ASTNode> &stmts,
260260
AccessSemantics::Ordinary, intType);
261261
}
262262

263-
/// Generates a guard statement that checks whether the given lhs and rhs
264-
/// variables are equal; if they are not, then the isEqual variable is set to
265-
/// false and a break statement is executed.
263+
/// Returns a generated guard statement that checks whether the given lhs and
264+
/// rhs expressions are equal. If not equal, the else block for the guard
265+
/// returns false.
266266
/// \p C The AST context.
267-
/// \p lhsVar The first variable to test for equality.
268-
/// \p rhsVar The second variable to test for equality.
269-
/// \p isEqualVar The variable to set to false if the guard condition fails.
267+
/// \p lhsExpr The first expression to compare for equality.
268+
/// \p rhsExpr The second expression to compare for equality.
270269
static GuardStmt *returnIfNotEqualGuard(ASTContext &C,
271270
Expr *lhsExpr,
272271
Expr *rhsExpr) {
273272
SmallVector<StmtConditionElement, 1> conditions;
274-
SmallVector<ASTNode, 2> statements;
273+
SmallVector<ASTNode, 1> statements;
275274

276-
// First, generate the statements for the body of the guard.
275+
// First, generate the statement for the body of the guard.
277276
// return false
278277
auto falseExpr = new (C) BooleanLiteralExpr(false, SourceLoc(),
279278
/*Implicit*/true);

0 commit comments

Comments
 (0)