Skip to content

[sourcekitd] Expose the 'implicit' symbol role in the 'index' request response #22764

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions test/SourceKit/Indexing/Inputs/implicit-vis/a.index.response
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,16 @@
key.usr: "s:12implicit_vis1AC1bAA1BCvg",
key.line: 2,
key.column: 6,
key.is_dynamic: 1
key.is_dynamic: 1,
key.is_implicit: 1
},
{
key.kind: source.lang.swift.decl.function.accessor.setter,
key.usr: "s:12implicit_vis1AC1bAA1BCvs",
key.line: 2,
key.column: 6,
key.is_dynamic: 1
key.is_dynamic: 1,
key.is_implicit: 1
}
]
},
Expand Down
6 changes: 4 additions & 2 deletions test/SourceKit/Indexing/Inputs/implicit-vis/b.index.response
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,16 @@
key.usr: "s:12implicit_vis1BC1aAA1ACvg",
key.line: 2,
key.column: 6,
key.is_dynamic: 1
key.is_dynamic: 1,
key.is_implicit: 1
},
{
key.kind: source.lang.swift.decl.function.accessor.setter,
key.usr: "s:12implicit_vis1BC1aAA1ACvs",
key.line: 2,
key.column: 6,
key.is_dynamic: 1
key.is_dynamic: 1,
key.is_implicit: 1
}
]
},
Expand Down
21 changes: 14 additions & 7 deletions test/SourceKit/Indexing/Inputs/test_module.index.response
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@
key.entities: [
{
key.kind: source.lang.swift.decl.function.constructor,
key.usr: "s:11test_module5EmptyCACycfc"
key.usr: "s:11test_module5EmptyCACycfc",
key.is_implicit: 1
}
]
},
Expand All @@ -49,12 +50,14 @@
{
key.kind: source.lang.swift.decl.function.accessor.getter,
key.usr: "s:11test_module7TwoIntsC1xSivg",
key.is_dynamic: 1
key.is_dynamic: 1,
key.is_implicit: 1
},
{
key.kind: source.lang.swift.decl.function.accessor.setter,
key.usr: "s:11test_module7TwoIntsC1xSivs",
key.is_dynamic: 1
key.is_dynamic: 1,
key.is_implicit: 1
}
]
},
Expand All @@ -66,12 +69,14 @@
{
key.kind: source.lang.swift.decl.function.accessor.getter,
key.usr: "s:11test_module7TwoIntsC1ySivg",
key.is_dynamic: 1
key.is_dynamic: 1,
key.is_implicit: 1
},
{
key.kind: source.lang.swift.decl.function.accessor.setter,
key.usr: "s:11test_module7TwoIntsC1ySivs",
key.is_dynamic: 1
key.is_dynamic: 1,
key.is_implicit: 1
}
]
},
Expand Down Expand Up @@ -108,7 +113,8 @@
},
{
key.kind: source.lang.swift.decl.function.constructor,
key.usr: "s:11test_module16ComputedPropertyCACycfc"
key.usr: "s:11test_module16ComputedPropertyCACycfc",
key.is_implicit: 1
}
]
},
Expand Down Expand Up @@ -141,7 +147,8 @@
key.entities: [
{
key.kind: source.lang.swift.decl.function.constructor,
key.usr: "s:11test_module2C2CACycfc"
key.usr: "s:11test_module2C2CACycfc",
key.is_implicit: 1
}
]
},
Expand Down
6 changes: 4 additions & 2 deletions test/SourceKit/Indexing/index_bad_modulename.swift.response
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,15 @@
key.kind: source.lang.swift.decl.function.accessor.getter,
key.usr: "s:4main1vSo8NSObjectCSgvg",
key.line: 9,
key.column: 5
key.column: 5,
key.is_implicit: 1
},
{
key.kind: source.lang.swift.decl.function.accessor.setter,
key.usr: "s:4main1vSo8NSObjectCSgvs",
key.line: 9,
key.column: 5
key.column: 5,
key.is_implicit: 1
}
]
},
Expand Down
6 changes: 4 additions & 2 deletions test/SourceKit/Indexing/index_big_array.swift.response
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,15 @@
key.kind: source.lang.swift.decl.function.accessor.getter,
key.usr: "s:9big_array15gCubeVertexDataSaySfGvg",
key.line: 1,
key.column: 5
key.column: 5,
key.is_implicit: 1
},
{
key.kind: source.lang.swift.decl.function.accessor.setter,
key.usr: "s:9big_array15gCubeVertexDataSaySfGvs",
key.line: 1,
key.column: 5
key.column: 5,
key.is_implicit: 1
}
]
},
Expand Down
6 changes: 4 additions & 2 deletions test/SourceKit/Indexing/index_constructors.swift.response
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,16 @@
key.usr: "s:18index_constructors11HorseObjectC4nameXevg",
key.line: 9,
key.column: 7,
key.is_dynamic: 1
key.is_dynamic: 1,
key.is_implicit: 1
},
{
key.kind: source.lang.swift.decl.function.accessor.setter,
key.usr: "s:18index_constructors11HorseObjectC4nameXevs",
key.line: 9,
key.column: 7,
key.is_dynamic: 1
key.is_dynamic: 1,
key.is_implicit: 1
}
]
},
Expand Down
6 changes: 4 additions & 2 deletions test/SourceKit/Indexing/index_enum_case.swift.response
Original file line number Diff line number Diff line change
Expand Up @@ -111,13 +111,15 @@
key.kind: source.lang.swift.decl.function.accessor.getter,
key.usr: "s:15index_enum_case1eAA1EOvg",
key.line: 21,
key.column: 5
key.column: 5,
key.is_implicit: 1
},
{
key.kind: source.lang.swift.decl.function.accessor.setter,
key.usr: "s:15index_enum_case1eAA1EOvs",
key.line: 21,
key.column: 5
key.column: 5,
key.is_implicit: 1
}
]
},
Expand Down
12 changes: 8 additions & 4 deletions test/SourceKit/Indexing/index_forbid_typecheck.swift.response
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,15 @@
key.kind: source.lang.swift.decl.function.accessor.getter,
key.usr: "s:16forbid_typecheck10globalPrimSivg",
key.line: 1,
key.column: 5
key.column: 5,
key.is_implicit: 1
},
{
key.kind: source.lang.swift.decl.function.accessor.setter,
key.usr: "s:16forbid_typecheck10globalPrimSivs",
key.line: 1,
key.column: 5
key.column: 5,
key.is_implicit: 1
}
]
},
Expand All @@ -42,7 +44,8 @@
key.kind: source.lang.swift.ref.function.accessor.getter,
key.usr: "s:16forbid_typecheck9globalSecSivg",
key.line: 1,
key.column: 18
key.column: 18,
key.is_implicit: 1
}
]
},
Expand Down Expand Up @@ -87,7 +90,8 @@
key.line: 5,
key.column: 20,
key.receiver_usr: "s:16forbid_typecheck6ClsSecC",
key.is_dynamic: 1
key.is_dynamic: 1,
key.is_implicit: 1
}
]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@
key.kind: source.lang.swift.decl.function.constructor,
key.usr: "s:23index_is_test_candidate8MyStructVACycfc",
key.line: 12,
key.column: 8
key.column: 8,
key.is_implicit: 1
}
]
},
Expand All @@ -50,7 +51,8 @@
key.kind: source.lang.swift.decl.function.constructor,
key.usr: "s:23index_is_test_candidate10XCTestCaseCACycfc",
key.line: 15,
key.column: 7
key.column: 7,
key.is_implicit: 1
}
]
},
Expand Down Expand Up @@ -90,6 +92,7 @@
key.usr: "s:23index_is_test_candidate14MyPrivateClass33_E06F4E7BC5F577AB6E2EC6D3ECA1C8B9LLCADycfc",
key.line: 16,
key.column: 43,
key.is_implicit: 1,
key.related: [
{
key.kind: source.lang.swift.ref.function.constructor,
Expand Down Expand Up @@ -212,6 +215,7 @@
key.usr: "s:23index_is_test_candidate7MyClassCACycfc",
key.line: 20,
key.column: 35,
key.is_implicit: 1,
key.related: [
{
key.kind: source.lang.swift.ref.function.constructor,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@
key.kind: source.lang.swift.decl.function.constructor,
key.usr: "s:28index_is_test_candidate_objc8MyStructVACycfc",
key.line: 11,
key.column: 8
key.column: 8,
key.is_implicit: 1
}
]
},
Expand All @@ -50,7 +51,8 @@
key.kind: source.lang.swift.decl.function.constructor,
key.usr: "s:28index_is_test_candidate_objc10XCTestCaseCACycfc",
key.line: 14,
key.column: 7
key.column: 7,
key.is_implicit: 1
}
]
},
Expand Down Expand Up @@ -91,6 +93,7 @@
key.usr: "s:28index_is_test_candidate_objc14MyPrivateClass33_32FED72643814BE1A523406CD2E729AALLCADycfc",
key.line: 15,
key.column: 43,
key.is_implicit: 1,
key.related: [
{
key.kind: source.lang.swift.ref.function.constructor,
Expand Down Expand Up @@ -214,6 +217,7 @@
key.usr: "s:28index_is_test_candidate_objc7MyClassCACycfc",
key.line: 19,
key.column: 35,
key.is_implicit: 1,
key.related: [
{
key.kind: source.lang.swift.ref.function.constructor,
Expand Down
3 changes: 2 additions & 1 deletion test/SourceKit/Indexing/index_operators.swift.response
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,8 @@
key.kind: source.lang.swift.decl.function.constructor,
key.usr: "s:15index_operators7StructBVACycfc",
key.line: 12,
key.column: 8
key.column: 8,
key.is_implicit: 1
}
]
}
Expand Down
3 changes: 2 additions & 1 deletion test/SourceKit/Indexing/rdar_21602898.swift.response
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@
key.kind: source.lang.swift.decl.function.constructor,
key.usr: "s:13rdar_216028981CCACycfc",
key.line: 5,
key.column: 7
key.column: 7,
key.is_implicit: 1
}
]
}
Expand Down
3 changes: 2 additions & 1 deletion test/SourceKit/Indexing/sr_3815.swift.response
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,8 @@
key.kind: source.lang.swift.decl.function.constructor,
key.usr: "s:7sr_38151SVACycfc",
key.line: 9,
key.column: 8
key.column: 8,
key.is_implicit: 1
}
]
}
Expand Down
1 change: 1 addition & 0 deletions tools/SourceKit/include/SourceKit/Core/LangSupport.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ struct EntityInfo {
StringRef ReceiverUSR;
bool IsDynamic = false;
bool IsTestCandidate = false;
bool IsImplicit = false;
unsigned Line = 0;
unsigned Column = 0;
ArrayRef<UIdent> Attrs;
Expand Down
1 change: 1 addition & 0 deletions tools/SourceKit/lib/SwiftLang/SwiftIndexing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ class SKIndexDataConsumer : public IndexDataConsumer {
info.Column = symbol.column;
info.ReceiverUSR = symbol.getReceiverUSR();
info.IsDynamic = symbol.roles & (unsigned)SymbolRole::Dynamic;
info.IsImplicit = symbol.roles & (unsigned)SymbolRole::Implicit;
info.IsTestCandidate = symbol.symInfo.Properties & SymbolProperty::UnitTest;
std::vector<UIdent> uidAttrs;
if (!isRef) {
Expand Down
2 changes: 2 additions & 0 deletions tools/SourceKit/tools/sourcekitd/lib/API/Requests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1230,6 +1230,8 @@ bool SKIndexingConsumer::startSourceEntity(const EntityInfo &Info) {
Elem.set(KeyReceiverUSR, Info.ReceiverUSR);
if (Info.IsDynamic)
Elem.setBool(KeyIsDynamic, true);
if (Info.IsImplicit)
Elem.setBool(KeyIsImplicit, true);
if (Info.IsTestCandidate)
Elem.setBool(KeyIsTestCandidate, true);

Expand Down
1 change: 1 addition & 0 deletions utils/gyb_sourcekit_support/UIDs.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ def __init__(self, internal_name, external_name):
KEY('Column', 'key.column'),
KEY('ReceiverUSR', 'key.receiver_usr'),
KEY('IsDynamic', 'key.is_dynamic'),
KEY('IsImplicit', 'key.is_implicit'),
KEY('FilePath', 'key.filepath'),
KEY('ModuleInterfaceName', 'key.module_interface_name'),
KEY('Hash', 'key.hash'),
Expand Down