Skip to content

Commit 48e8b3e

Browse files
committed
Miscellaneous style improvements
1 parent 0f7aabd commit 48e8b3e

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
@@ -985,7 +985,7 @@ class alignas(1 << DeclAlignInBits) Decl : public ASTAllocated<Decl> {
985985
/// returns the imported declaration. Otherwise return \c nullptr.
986986
///
987987
/// \seeAlso ExtensionDecl::isObjCInterface()
988-
Decl *getObjCInterfaceDecl() const;
988+
Decl *getImplementedObjCDecl() const;
989989

990990
/// If this is the ObjC interface of a declaration implemented in Swift,
991991
/// 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
@@ -5182,7 +5182,7 @@ swift::extractNearestSourceLoc(const ObjCInterfaceAndImplementation &pair) {
51825182
return extractNearestSourceLoc(pair.implementationDecl);
51835183
}
51845184

5185-
Decl *Decl::getObjCInterfaceDecl() const {
5185+
Decl *Decl::getImplementedObjCDecl() const {
51865186
if (hasClangNode())
51875187
// This *is* the interface, if there is one.
51885188
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
@@ -1392,7 +1392,7 @@ visitObjCImplementationAttr(ObjCImplementationAttr *attr) {
13921392
return;
13931393
}
13941394

1395-
if (!attr->isCategoryNameInvalid() && !ED->getObjCInterfaceDecl()) {
1395+
if (!attr->isCategoryNameInvalid() && !ED->getImplementedObjCDecl()) {
13961396
diagnose(attr->getLocation(),
13971397
diag::attr_objc_implementation_category_not_found,
13981398
attr->CategoryName, CD);

lib/Sema/TypeCheckDeclObjC.cpp

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

18741874
auto contextInterface =
1875-
dyn_cast<IterableDeclContext>(ext->getObjCInterfaceDecl());
1875+
dyn_cast<IterableDeclContext>(ext->getImplementedObjCDecl());
18761876

18771877
for (auto otherMember : contextInterface->getMembers()) {
18781878
auto otherMethod = dyn_cast<AbstractFunctionDecl>(otherMember);
@@ -2046,7 +2046,7 @@ void markAsObjC(ValueDecl *D, ObjCReason reason,
20462046

20472047
// Record the method in the type, if it's a member of one.
20482048
if (auto tyDecl = D->getDeclContext()->getSelfNominalTypeDecl()) {
2049-
// FIXME: Should be able to check method->getObjCInterfaceDecl(), but we
2049+
// FIXME: Should be able to check method->getImplementedObjCDecl(), but we
20502050
// don't have that matching yet.
20512051
if (!isObjCImplementation(method, selector))
20522052
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)