Skip to content

Commit da2de4d

Browse files
committed
[AST] Promote getLifetimeAnnotation.
Move it up to Decl in preparation for getting it from AbstractFuncDecls.
1 parent 158c782 commit da2de4d

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

include/swift/AST/Decl.h

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -986,6 +986,15 @@ class alignas(1 << DeclAlignInBits) Decl : public ASTAllocated<Decl> {
986986
/// Check if this is a declaration defined at the top level of the Swift module
987987
bool isStdlibDecl() const;
988988

989+
LifetimeAnnotation getLifetimeAnnotation() const {
990+
auto &attrs = getAttrs();
991+
if (attrs.hasAttribute<EagerMoveAttr>())
992+
return LifetimeAnnotation::EagerMove;
993+
if (attrs.hasAttribute<LexicalAttr>())
994+
return LifetimeAnnotation::Lexical;
995+
return LifetimeAnnotation::None;
996+
}
997+
989998
bool isNoImplicitCopy() const {
990999
return getAttrs().hasAttribute<NoImplicitCopyAttr>();
9911000
}
@@ -2718,15 +2727,6 @@ class ValueDecl : public Decl {
27182727
/// 'func foo(Int) -> () -> Self?'.
27192728
GenericParameterReferenceInfo findExistentialSelfReferences(
27202729
Type baseTy, bool treatNonResultCovariantSelfAsInvariant) const;
2721-
2722-
LifetimeAnnotation getLifetimeAnnotation() const {
2723-
auto &attrs = getAttrs();
2724-
if (attrs.hasAttribute<EagerMoveAttr>())
2725-
return LifetimeAnnotation::EagerMove;
2726-
if (attrs.hasAttribute<LexicalAttr>())
2727-
return LifetimeAnnotation::Lexical;
2728-
return LifetimeAnnotation::None;
2729-
}
27302730
};
27312731

27322732
/// This is a common base class for declarations which declare a type.

0 commit comments

Comments
 (0)