Skip to content

Commit bc79f30

Browse files
committed
swift-api-digester: diagnose removal/addition of dynamic attribute under abi mode.
1 parent 2152d0b commit bc79f30

File tree

5 files changed

+14
-3
lines changed

5 files changed

+14
-3
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 & 1 deletion
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() {

0 commit comments

Comments
 (0)