Skip to content

Commit 9dd88e2

Browse files
committed
[NFC] LifetimeDependence: fix indentation
To avoid diff/merge confusion.
1 parent 1d83fe3 commit 9dd88e2

File tree

1 file changed

+27
-25
lines changed

1 file changed

+27
-25
lines changed

lib/AST/LifetimeDependence.cpp

Lines changed: 27 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -651,37 +651,39 @@ class LifetimeDependenceChecker {
651651

652652
case ParsedLifetimeDependenceKind::Borrow: LLVM_FALLTHROUGH;
653653
case ParsedLifetimeDependenceKind::Inout: {
654-
// @lifetime(borrow x) is valid only for borrowing parameters.
655-
// @lifetime(inout x) is valid only for inout parameters.
656-
if (!isCompatibleWithOwnership(parsedLifetimeKind, type, loweredOwnership,
657-
isInterfaceFile())) {
658-
diagnose(loc,
659-
diag::lifetime_dependence_cannot_use_parsed_borrow_consuming,
660-
getNameForParsedLifetimeDependenceKind(parsedLifetimeKind),
661-
getOwnershipSpelling(loweredOwnership));
662-
return std::nullopt;
663-
}
664-
return LifetimeDependenceKind::Scope;
665-
}
666-
case ParsedLifetimeDependenceKind::Inherit:
667-
// @lifetime(copy x) is only invalid for Escapable types.
668-
if (type->isEscapable()) {
669-
if (loweredOwnership == ValueOwnership::Shared) {
670-
diagnose(loc, diag::lifetime_dependence_invalid_inherit_escapable_type,
671-
descriptor.getString(), "borrow ");
672-
} else if (loweredOwnership == ValueOwnership::InOut) {
673-
diagnose(loc, diag::lifetime_dependence_invalid_inherit_escapable_type,
674-
descriptor.getString(), "&");
675-
} else {
654+
// @lifetime(borrow x) is valid only for borrowing parameters.
655+
// @lifetime(&x) is valid only for inout parameters.
656+
if (!isCompatibleWithOwnership(parsedLifetimeKind, type, loweredOwnership,
657+
isInterfaceFile())) {
676658
diagnose(
659+
loc,
660+
diag::lifetime_dependence_cannot_use_parsed_borrow_consuming,
661+
getNameForParsedLifetimeDependenceKind(parsedLifetimeKind),
662+
getOwnershipSpelling(loweredOwnership));
663+
return std::nullopt;
664+
}
665+
return LifetimeDependenceKind::Scope;
666+
}
667+
case ParsedLifetimeDependenceKind::Inherit: {
668+
// @lifetime(copy x) is only invalid for Escapable types.
669+
if (type->isEscapable()) {
670+
if (loweredOwnership == ValueOwnership::Shared) {
671+
diagnose(loc, diag::lifetime_dependence_invalid_inherit_escapable_type,
672+
descriptor.getString(), "borrow ");
673+
} else if (loweredOwnership == ValueOwnership::InOut) {
674+
diagnose(loc, diag::lifetime_dependence_invalid_inherit_escapable_type,
675+
descriptor.getString(), "&");
676+
} else {
677+
diagnose(
677678
loc,
678679
diag::lifetime_dependence_cannot_use_default_escapable_consuming,
679680
getOwnershipSpelling(loweredOwnership));
681+
}
682+
return std::nullopt;
680683
}
681-
return std::nullopt;
684+
return LifetimeDependenceKind::Inherit;
685+
}
682686
}
683-
return LifetimeDependenceKind::Inherit;
684-
}
685687
}
686688

687689
// Finds the ParamDecl* and its index from a LifetimeDescriptor

0 commit comments

Comments
 (0)