Skip to content

[SR-1639] [SourceKit] Add in-process implementations of sourcekitd functions only defined for XPC #5268

@modocache

Description

@modocache
mannequin
Previous ID SR-1639
Radar None
Original Reporter @modocache
Type Sub-task
Status Closed
Resolution Done

Attachment: Download

Additional Detail from JIRA
Votes 0
Component/s Package Manager, XCTest
Labels Sub-task
Assignee @briancroom
Priority Medium

md5: e2fa900ee64d58b2f3449789c3d4d373

Parent-Task:

  • SR-710 Generate XCTestCaseProvider entries on Linux

blocks:

Issue Description:

Several SourceKit functions are declared in tools/SourceKit/tools/sourcekitd/include/sourcekitd/sourcekitd.h or tools/SourceKit/tools/sourcekitd/include/sourcekitd/Internal.h, but only implemented in tools/SourceKit/tools/sourcekitd/lib/API/sourcekitdAPI-XPC.cpp. These need implementations that are only included in builds of SourceKit that use an in-process communication model (in other words, not XPC).

Examples of missing implementations include sourcekitd_request_array_create and createErrorRequestInvalid. There are many more.

I noticed these missing implementations when attempting to build SourceKit for Linux (full output available here and as a attachment on this task).

To build SourceKit on Linux yourself, apply swiftlang/swift#2763 and swiftlang/swift#2704 to a branch based off the master branch of apple/swift, then run utils/build-script -R.

Taking the unique symbols from the build output above, I think the following will need "in-process" definitions:

Declared in SourceKit/include/SourceKit/Support/Concurrency.h, implemented for OS X in SourceKit/lib/Support/Concurrency-Mac.cpp:

  1. SourceKit::WorkQueue::Impl::create(SourceKit::WorkQueue::Dequeuing, SourceKit::WorkQueue::Priority, llvm::StringRef)

  2. SourceKit::WorkQueue::Impl::dispatch(void*, SourceKit::WorkQueue::DispatchData const&)

  3. SourceKit::WorkQueue::Impl::dispatchBarrierSync(void*, SourceKit::WorkQueue::DispatchData const&)

  4. SourceKit::WorkQueue::Impl::dispatchConcurrent(SourceKit::WorkQueue::Priority, SourceKit::WorkQueue::DispatchData const&)

  5. SourceKit::WorkQueue::Impl::dispatchOnMain(SourceKit::WorkQueue::DispatchData const&)

  6. SourceKit::WorkQueue::Impl::dispatchSync(void*, SourceKit::WorkQueue::DispatchData const&)

  7. SourceKit::WorkQueue::Impl::release(void*)

I think these need implementations for Linux.

Declared in tools/SourceKit/tools/sourcekitd/include/sourcekitd/sourcekitd.h, implemented for OS X in tools/SourceKit/tools/sourcekitd/lib/API/sourcekitdAPI-XPC.cpp:

  1. sourcekitd_request_array_create

  2. sourcekitd_request_array_set_value

  3. sourcekitd_request_dictionary_create

  4. sourcekitd_request_dictionary_set_value

  5. sourcekitd_request_int64_create

  6. sourcekitd_request_release

  7. sourcekitd_request_retain

  8. sourcekitd_request_string_create

  9. sourcekitd_request_uid_create

  10. sourcekitd_response_dispose

  11. sourcekitd_response_error_get_description

  12. sourcekitd_response_error_get_kind

  13. sourcekitd_response_get_value

  14. sourcekitd_response_is_error

  15. sourcekitd_uid_get_from_buf

  16. sourcekitd_uid_get_length

  17. sourcekitd_uid_get_string_ptr

I think these need implementations for Linux.

Declared in tools/SourceKit/tools/sourcekitd/include/sourcekitd/Internal.h, implemented for OS X in tools/SourceKit/tools/sourcekitd/lib/API/sourcekitdAPI-XPC.cpp:

  1. sourcekitd::RequestDict::dictionaryArrayApply(SourceKit::UIdent, llvm::function_ref<bool (sourcekitd::RequestDict)>)

  2. sourcekitd::RequestDict::getDictionary(SourceKit::UIdent)

  3. sourcekitd::RequestDict::getInt64(SourceKit::UIdent, long&, bool)

  4. sourcekitd::RequestDict::getString(SourceKit::UIdent)

  5. sourcekitd::RequestDict::getStringArray(SourceKit::UIdent, llvm::SmallVectorImpl<char const*>&, bool)

  6. sourcekitd::RequestDict::getUID(SourceKit::UIdent)

  7. sourcekitd::RequestDict::getUIDArray(SourceKit::UIdent, llvm::SmallVectorImpl<sourcekitd_uid_s*>&, bool)

  8. sourcekitd::ResponseBuilder::Array::appendDictionary()

  9. sourcekitd::ResponseBuilder::Dictionary::set(SourceKit::UIdent, SourceKit::UIdent)

  10. sourcekitd::ResponseBuilder::Dictionary::set(SourceKit::UIdent, char const*)

  11. sourcekitd::ResponseBuilder::Dictionary::set(SourceKit::UIdent, llvm::ArrayRef<llvm::StringRef>)

  12. sourcekitd::ResponseBuilder::Dictionary::set(SourceKit::UIdent, llvm::StringRef)

  13. sourcekitd::ResponseBuilder::Dictionary::set(SourceKit::UIdent, long)

  14. sourcekitd::ResponseBuilder::Dictionary::set(SourceKit::UIdent, sourcekitd_uid_s*)

  15. sourcekitd::ResponseBuilder::Dictionary::setArray(SourceKit::UIdent)

  16. sourcekitd::ResponseBuilder::Dictionary::setBool(SourceKit::UIdent, bool)

  17. sourcekitd::ResponseBuilder::Dictionary::setCustomBuffer(SourceKit::UIdent, sourcekitd::CustomBufferKind, std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer> >)

  18. sourcekitd::ResponseBuilder::Dictionary::setDictionary(SourceKit::UIdent)

  19. sourcekitd::ResponseBuilder::ResponseBuilder()

  20. sourcekitd::ResponseBuilder::createResponse()

  21. sourcekitd::ResponseBuilder::getDictionary()

  22. sourcekitd::ResponseBuilder::~ResponseBuilder()

  23. sourcekitd::createErrorRequestCancelled()

  24. sourcekitd::createErrorRequestFailed(char const*)

  25. sourcekitd::createErrorRequestInvalid(char const*)

  26. sourcekitd::printRequestObject(void*, llvm::raw_ostream&)

I think these need implementations for Linux.

Declared in tools/SourceKit/include/SourceKit/Core/LangSupport.h, implemented for all platforms in tools/SourceKit/lib/SwiftLang/SwiftLangSupport.cpp:

  1. SourceKit::LangSupport::SynthesizedUSRSeparator

  2. SourceKit::LangSupport::createSwiftLangSupport(SourceKit::Context&)

I think sourcekitdInProc needs to be linked against SourceKitSwiftLang to resolve these symbols.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions