Skip to content

Commit 8eaae59

Browse files
committed
[NFC] AST: Moved impl from Sema.
Now that the function is declared in AST, it should be implemented there.
1 parent 38a9ef7 commit 8eaae59

File tree

2 files changed

+28
-28
lines changed

2 files changed

+28
-28
lines changed

lib/AST/Decl.cpp

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10540,6 +10540,34 @@ ArrayRef<VarDecl *> AccessorDecl::getAccessedProperties() const {
1054010540
return {};
1054110541
}
1054210542

10543+
bool AccessorDecl::doesAccessorHaveBody() const {
10544+
auto *accessor = this;
10545+
auto *storage = accessor->getStorage();
10546+
10547+
if (isa<ProtocolDecl>(accessor->getDeclContext())) {
10548+
if (!accessor->getASTContext().LangOpts.hasFeature(
10549+
Feature::CoroutineAccessors)) {
10550+
return false;
10551+
}
10552+
if (!requiresFeatureCoroutineAccessors(accessor->getAccessorKind())) {
10553+
return false;
10554+
}
10555+
if (storage->getOverrideLoc()) {
10556+
return false;
10557+
}
10558+
return accessor->getStorage()
10559+
->requiresCorrespondingUnderscoredCoroutineAccessor(
10560+
accessor->getAccessorKind(), accessor);
10561+
}
10562+
10563+
// NSManaged getters and setters don't have bodies.
10564+
if (storage->getAttrs().hasAttribute<NSManagedAttr>(/*AllowInvalid=*/true))
10565+
if (accessor->isGetterOrSetter())
10566+
return false;
10567+
10568+
return true;
10569+
}
10570+
1054310571
StaticSpellingKind FuncDecl::getCorrectStaticSpelling() const {
1054410572
assert(getDeclContext()->isTypeContext());
1054510573
if (!isStatic())

lib/Sema/TypeCheckStorage.cpp

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -938,34 +938,6 @@ buildIndexForwardingParamList(AbstractStorageDecl *storage,
938938
return ParameterList::create(context, elements);
939939
}
940940

941-
bool AccessorDecl::doesAccessorHaveBody() const {
942-
auto *accessor = this;
943-
auto *storage = accessor->getStorage();
944-
945-
if (isa<ProtocolDecl>(accessor->getDeclContext())) {
946-
if (!accessor->getASTContext().LangOpts.hasFeature(
947-
Feature::CoroutineAccessors)) {
948-
return false;
949-
}
950-
if (!requiresFeatureCoroutineAccessors(accessor->getAccessorKind())) {
951-
return false;
952-
}
953-
if (storage->getOverrideLoc()) {
954-
return false;
955-
}
956-
return accessor->getStorage()
957-
->requiresCorrespondingUnderscoredCoroutineAccessor(
958-
accessor->getAccessorKind(), accessor);
959-
}
960-
961-
// NSManaged getters and setters don't have bodies.
962-
if (storage->getAttrs().hasAttribute<NSManagedAttr>(/*AllowInvalid=*/true))
963-
if (accessor->isGetterOrSetter())
964-
return false;
965-
966-
return true;
967-
}
968-
969941
/// Build an argument list referencing the subscript parameters for this
970942
/// subscript accessor.
971943
static ArgumentList *buildSubscriptArgumentList(ASTContext &ctx,

0 commit comments

Comments
 (0)