Skip to content

Commit febc065

Browse files
authored
Merge pull request #18775 from nkcsgexi/reorder-abi
2 parents 9c5f9ce + bc79f30 commit febc065

File tree

5 files changed

+14
-44
lines changed

5 files changed

+14
-44
lines changed

include/swift/IDE/DigesterEnums.def

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ NODE_ANNOTATION(OwnershipChange)
6262
NODE_ANNOTATION(ChangeObjC)
6363
NODE_ANNOTATION(ChangeFixedLayout)
6464
NODE_ANNOTATION(ChangeFrozen)
65+
NODE_ANNOTATION(ChangeDynamic)
6566
NODE_ANNOTATION(ChangeGenericSignature)
6667
NODE_ANNOTATION(RawTypeLeft)
6768
NODE_ANNOTATION(RawTypeRight)

test/api-digester/Inputs/cake1.swift

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,10 @@ public class C4: OldType {
3030
}
3131

3232
@objc
33-
public class C5 {}
33+
public class C5 {
34+
@objc
35+
public func dy_foo() {}
36+
}
3437

3538
public struct C6 {}
3639

test/api-digester/Inputs/cake2.swift

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,10 @@ public struct NSSomestruct2 {
3030

3131
public class C4: NewType {}
3232

33-
public class C5 {}
33+
public class C5 {
34+
@objc
35+
public dynamic func dy_foo() {}
36+
}
3437

3538
@_fixed_layout
3639
public struct C6 {}

test/api-digester/Outputs/Cake-abi.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,6 @@ cake1: Class C5 is now without @objc
2626
cake1: Var C1.CIIns1 changes from weak to strong
2727
cake1: Var C1.CIIns2 changes from strong to weak
2828
cake1: Func C1.foo1() is now not static
29+
cake1: Func C5.dy_foo() is now with dynamic
2930
cake1: Func S1.foo1() is now mutating
3031
cake1: Func S1.foo3() is now static

tools/swift-api-digester/swift-api-digester.cpp

Lines changed: 4 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,9 @@ class SDKContext {
273273

274274
static StringRef getAttrName(DeclAttrKind Kind) {
275275
switch (Kind) {
276-
#define DECL_ATTR(NAME, CLASS, ...) case DAK_##CLASS: return "@"#NAME;
276+
#define DECL_ATTR(NAME, CLASS, ...) \
277+
case DAK_##CLASS: \
278+
return DeclAttribute::isDeclModifier(DAK_##CLASS) ? #NAME : "@"#NAME;
277279
#include "swift/AST/Attr.def"
278280
case DAK_Count:
279281
llvm_unreachable("unrecognized attribute kind.");
@@ -287,6 +289,7 @@ class SDKContext {
287289
ADD(ObjC)
288290
ADD(FixedLayout)
289291
ADD(Frozen)
292+
ADD(Dynamic)
290293
#undef ADD
291294
}
292295
llvm::BumpPtrAllocator &allocator() {
@@ -3765,47 +3768,6 @@ class NoEscapingFuncEmitter : public SDKNodeVisitor {
37653768
SDKNode::postorderVisit(Root, Emitter);
37663769
}
37673770
};
3768-
3769-
class OverloadMemberFunctionEmitter : public SDKNodeVisitor {
3770-
3771-
std::vector<OverloadedFuncInfo> &AllItems;
3772-
3773-
void visit(NodePtr Node) override {
3774-
if (Node->getKind() != SDKNodeKind::DeclFunction)
3775-
return;
3776-
auto Parent = Node->getParent();
3777-
if (Parent->getKind() != SDKNodeKind::DeclType)
3778-
return;
3779-
DeclNameViewer CurrentViewer(Node->getPrintedName());
3780-
if (CurrentViewer.args().empty())
3781-
return;
3782-
for (auto &C : Parent->getChildren()) {
3783-
if (C == Node)
3784-
continue;
3785-
if (C->getKind() != SDKNodeKind::DeclFunction)
3786-
continue;
3787-
DeclNameViewer ChildViewer(C->getPrintedName());
3788-
if (ChildViewer.args().empty())
3789-
continue;
3790-
if (CurrentViewer.commonPartsCount(ChildViewer) >=
3791-
CurrentViewer.partsCount() - 1) {
3792-
AllItems.emplace_back(Node->getAs<SDKNodeDecl>()->getUsr());
3793-
return;
3794-
}
3795-
}
3796-
}
3797-
3798-
OverloadMemberFunctionEmitter(std::vector<OverloadedFuncInfo> &AllItems) :
3799-
AllItems(AllItems) {}
3800-
3801-
public:
3802-
static void collectDiffItems(NodePtr Root,
3803-
std::vector<OverloadedFuncInfo> &AllItems) {
3804-
OverloadMemberFunctionEmitter Emitter(AllItems);
3805-
SDKNode::postorderVisit(Root, Emitter);
3806-
}
3807-
};
3808-
38093771
} // end anonymous namespace
38103772

38113773
namespace fs = llvm::sys::fs;

0 commit comments

Comments
 (0)