Skip to content

Commit 209d6d9

Browse files
authored
Merge pull request #19633 from nkcsgexi/internal-node-diag
2 parents 84bb580 + 6a198b1 commit 209d6d9

File tree

5 files changed

+32
-10
lines changed

5 files changed

+32
-10
lines changed

include/swift/IDE/DigesterEnums.def

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@ KEY_BOOL(HasDefaultArg, hasDefaultArg)
126126
KEY_BOOL(HasSetter, hasSetter)
127127
KEY_BOOL(IsLet, isLet)
128128
KEY_BOOL(IsOpen, isOpen)
129+
KEY_BOOL(IsInternal, isInternal)
129130
KEY_BOOL(HasStorage, hasStorage)
130131

131132
KEY(kind)

test/api-digester/Outputs/cake-abi.json

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,8 @@
118118
"declKind": "Constructor",
119119
"usr": "s:4cake2S1VACycfc",
120120
"moduleName": "cake",
121-
"implicit": true
121+
"implicit": true,
122+
"isInternal": true
122123
}
123124
],
124125
"declKind": "Struct",
@@ -170,7 +171,8 @@
170171
"usr": "s:4cake2C0CACyxq_q0_Gycfc",
171172
"moduleName": "cake",
172173
"genericSig": "<τ_0_0, τ_0_1, τ_0_2>",
173-
"implicit": true
174+
"implicit": true,
175+
"isInternal": true
174176
},
175177
{
176178
"kind": "Function",
@@ -396,7 +398,8 @@
396398
"usr": "s:4cake2C1CACycfc",
397399
"moduleName": "cake",
398400
"overriding": true,
399-
"implicit": true
401+
"implicit": true,
402+
"isInternal": true
400403
}
401404
],
402405
"declKind": "Class",
@@ -777,6 +780,7 @@
777780
"usr": "s:4cake17fixedLayoutStructV1b33_3D8926C30F7417F2EF9A277D0C73FBDBLLSivg",
778781
"moduleName": "cake",
779782
"implicit": true,
783+
"isInternal": true,
780784
"declAttributes": [
781785
"Transparent"
782786
]
@@ -785,6 +789,7 @@
785789
"declKind": "Var",
786790
"usr": "s:4cake17fixedLayoutStructV1b33_3D8926C30F7417F2EF9A277D0C73FBDBLLSivp",
787791
"moduleName": "cake",
792+
"isInternal": true,
788793
"declAttributes": [
789794
"HasInitialValue"
790795
],
@@ -818,6 +823,7 @@
818823
"usr": "s:4cake17fixedLayoutStructV1cSivg",
819824
"moduleName": "cake",
820825
"implicit": true,
826+
"isInternal": true,
821827
"declAttributes": [
822828
"Transparent"
823829
]
@@ -826,6 +832,7 @@
826832
"declKind": "Var",
827833
"usr": "s:4cake17fixedLayoutStructV1cSivp",
828834
"moduleName": "cake",
835+
"isInternal": true,
829836
"declAttributes": [
830837
"HasInitialValue"
831838
],
@@ -865,7 +872,8 @@
865872
"declKind": "Constructor",
866873
"usr": "s:4cake17fixedLayoutStructV1a1b1cACSi_S2itc33_3D8926C30F7417F2EF9A277D0C73FBDBLlfc",
867874
"moduleName": "cake",
868-
"implicit": true
875+
"implicit": true,
876+
"isInternal": true
869877
},
870878
{
871879
"kind": "Constructor",
@@ -882,7 +890,8 @@
882890
"declKind": "Constructor",
883891
"usr": "s:4cake17fixedLayoutStructVACycfc",
884892
"moduleName": "cake",
885-
"implicit": true
893+
"implicit": true,
894+
"isInternal": true
886895
}
887896
],
888897
"declKind": "Struct",

test/api-digester/Outputs/cake.json

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,8 @@
125125
"declKind": "Constructor",
126126
"usr": "s:4cake2S1VACycfc",
127127
"moduleName": "cake",
128-
"implicit": true
128+
"implicit": true,
129+
"isInternal": true
129130
}
130131
],
131132
"declKind": "Struct",
@@ -177,7 +178,8 @@
177178
"usr": "s:4cake2C0CACyxq_q0_Gycfc",
178179
"moduleName": "cake",
179180
"genericSig": "<T1, T2, T3>",
180-
"implicit": true
181+
"implicit": true,
182+
"isInternal": true
181183
},
182184
{
183185
"kind": "Function",
@@ -439,7 +441,8 @@
439441
"usr": "s:4cake2C1CACycfc",
440442
"moduleName": "cake",
441443
"overriding": true,
442-
"implicit": true
444+
"implicit": true,
445+
"isInternal": true
443446
}
444447
],
445448
"declKind": "Class",
@@ -850,7 +853,8 @@
850853
"declKind": "Constructor",
851854
"usr": "s:4cake17fixedLayoutStructV1a1b1cACSi_S2itc33_3D8926C30F7417F2EF9A277D0C73FBDBLlfc",
852855
"moduleName": "cake",
853-
"implicit": true
856+
"implicit": true,
857+
"isInternal": true
854858
},
855859
{
856860
"kind": "Constructor",
@@ -867,7 +871,8 @@
867871
"declKind": "Constructor",
868872
"usr": "s:4cake17fixedLayoutStructVACycfc",
869873
"moduleName": "cake",
870-
"implicit": true
874+
"implicit": true,
875+
"isInternal": true
871876
}
872877
],
873878
"declKind": "Struct",

tools/swift-api-digester/ModuleAnalyzerNodes.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ SDKNodeDecl::SDKNodeDecl(SDKNodeInitInfo Info, SDKNodeKind Kind)
6969
IsProtocolReq(Info.IsProtocolReq),
7070
IsOverriding(Info.IsOverriding),
7171
IsOpen(Info.IsOpen),
72+
IsInternal(Info.IsInternal),
7273
ReferenceOwnership(uint8_t(Info.ReferenceOwnership)),
7374
GenericSig(Info.GenericSig) {}
7475

@@ -731,6 +732,8 @@ bool static isSDKNodeEqual(SDKContext &Ctx, const SDKNode &L, const SDKNode &R)
731732
return false;
732733
if (Left->isOpen() != Right->isOpen())
733734
return false;
735+
if (Left->isInternal() != Right->isInternal())
736+
return false;
734737
LLVM_FALLTHROUGH;
735738
}
736739
case SDKNodeKind::Root: {
@@ -1019,6 +1022,7 @@ SDKNodeInitInfo::SDKNodeInitInfo(SDKContext &Ctx, ValueDecl *VD)
10191022
IsOverriding(VD->getOverriddenDecl()),
10201023
IsProtocolReq(isa<ProtocolDecl>(VD->getDeclContext()) && VD->isProtocolRequirement()),
10211024
IsOpen(VD->getFormalAccess() == AccessLevel::Open),
1025+
IsInternal(VD->getFormalAccess() < AccessLevel::Public),
10221026
SelfIndex(getSelfIndex(VD)), FixedBinaryOrder(getFixedBinaryOrder(VD)),
10231027
ReferenceOwnership(getReferenceOwnership(VD)) {
10241028

@@ -1421,6 +1425,7 @@ void SDKNodeDecl::jsonize(json::Output &out) {
14211425
output(out, KeyKind::KK_overriding, IsOverriding);
14221426
output(out, KeyKind::KK_implicit, IsImplicit);
14231427
output(out, KeyKind::KK_isOpen, IsOpen);
1428+
output(out, KeyKind::KK_isInternal, IsInternal);
14241429
out.mapOptional(getKeyContent(Ctx, KeyKind::KK_declAttributes).data(), DeclAttributes);
14251430
// Strong reference is implied, no need for serialization.
14261431
if (getReferenceOwnership() != ReferenceOwnership::Strong) {

tools/swift-api-digester/ModuleAnalyzerNodes.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -293,6 +293,7 @@ class SDKNodeDecl: public SDKNode {
293293
bool IsProtocolReq;
294294
bool IsOverriding;
295295
bool IsOpen;
296+
bool IsInternal;
296297
uint8_t ReferenceOwnership;
297298
StringRef GenericSig;
298299

@@ -323,6 +324,7 @@ class SDKNodeDecl: public SDKNode {
323324
bool isOverriding() const { return IsOverriding; };
324325
bool isOptional() const { return hasDeclAttribute(DeclAttrKind::DAK_Optional); }
325326
bool isOpen() const { return IsOpen; }
327+
bool isInternal() const { return IsInternal; }
326328
StringRef getGenericSignature() const { return GenericSig; }
327329
StringRef getScreenInfo() const;
328330
virtual void jsonize(json::Output &Out) override;

0 commit comments

Comments
 (0)