Skip to content

Commit 7e813fb

Browse files
committed
Miscellaneous style improvements
1 parent b5be80a commit 7e813fb

File tree

6 files changed

+9
-6
lines changed

6 files changed

+9
-6
lines changed

include/swift/AST/Decl.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -986,7 +986,7 @@ class alignas(1 << DeclAlignInBits) Decl : public ASTAllocated<Decl> {
986986
/// returns the imported declaration. Otherwise return \c nullptr.
987987
///
988988
/// \seeAlso ExtensionDecl::isObjCInterface()
989-
Decl *getObjCInterfaceDecl() const;
989+
Decl *getImplementedObjCDecl() const;
990990

991991
/// If this is the ObjC interface of a declaration implemented in Swift,
992992
/// returns the implementating declaration. Otherwise return \c nullptr.

lib/ClangImporter/ClangImporter.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5188,7 +5188,7 @@ swift::extractNearestSourceLoc(const ObjCInterfaceAndImplementation &pair) {
51885188
return extractNearestSourceLoc(pair.implementationDecl);
51895189
}
51905190

5191-
Decl *Decl::getObjCInterfaceDecl() const {
5191+
Decl *Decl::getImplementedObjCDecl() const {
51925192
if (hasClangNode())
51935193
// This *is* the interface, if there is one.
51945194
return nullptr;

lib/IRGen/GenClass.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1341,6 +1341,9 @@ namespace {
13411341
llvm::Constant *getClassMetadataRef() {
13421342
auto *theClass = getClass();
13431343

1344+
// If this is truly an imported ObjC class, with no @_objcImplementation,
1345+
// someone else will emit the ObjC metadata symbol and we simply want to
1346+
// use it.
13441347
if (theClass->hasClangNode() &&
13451348
!theClass->getObjCImplementationDecl())
13461349
return IGM.getAddrOfObjCClass(theClass, NotForDefinition);

lib/Sema/TypeCheckAttr.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1417,7 +1417,7 @@ visitObjCImplementationAttr(ObjCImplementationAttr *attr) {
14171417
return;
14181418
}
14191419

1420-
if (!attr->isCategoryNameInvalid() && !ED->getObjCInterfaceDecl()) {
1420+
if (!attr->isCategoryNameInvalid() && !ED->getImplementedObjCDecl()) {
14211421
diagnose(attr->getLocation(),
14221422
diag::attr_objc_implementation_category_not_found,
14231423
attr->CategoryName, CD);

lib/Sema/TypeCheckDeclObjC.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1875,7 +1875,7 @@ static bool isObjCImplementation(AbstractFunctionDecl *method,
18751875
return false;
18761876

18771877
auto contextInterface =
1878-
dyn_cast<IterableDeclContext>(ext->getObjCInterfaceDecl());
1878+
dyn_cast<IterableDeclContext>(ext->getImplementedObjCDecl());
18791879

18801880
for (auto otherMember : contextInterface->getMembers()) {
18811881
auto otherMethod = dyn_cast<AbstractFunctionDecl>(otherMember);
@@ -2049,7 +2049,7 @@ void markAsObjC(ValueDecl *D, ObjCReason reason,
20492049

20502050
// Record the method in the type, if it's a member of one.
20512051
if (auto tyDecl = D->getDeclContext()->getSelfNominalTypeDecl()) {
2052-
// FIXME: Should be able to check method->getObjCInterfaceDecl(), but we
2052+
// FIXME: Should be able to check method->getImplementedObjCDecl(), but we
20532053
// don't have that matching yet.
20542054
if (!isObjCImplementation(method, selector))
20552055
tyDecl->recordObjCMethod(method, selector);

lib/TBDGen/TBDGen.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1014,7 +1014,7 @@ void TBDGenVisitor::visitDestructorDecl(DestructorDecl *DD) {
10141014
}
10151015

10161016
void TBDGenVisitor::visitExtensionDecl(ExtensionDecl *ED) {
1017-
if (auto CD = dyn_cast_or_null<ClassDecl>(ED->getObjCInterfaceDecl())) {
1017+
if (auto CD = dyn_cast_or_null<ClassDecl>(ED->getImplementedObjCDecl())) {
10181018
// Generate symbols for the class instead of the extension.
10191019
visitClassDecl(CD);
10201020
return;

0 commit comments

Comments
 (0)