diff --git a/tools/SourceKit/tools/sourcekitd/lib/API/CMakeLists.txt b/tools/SourceKit/tools/sourcekitd/lib/API/CMakeLists.txt index f04952857afcf..086dcbe7e3a42 100644 --- a/tools/SourceKit/tools/sourcekitd/lib/API/CMakeLists.txt +++ b/tools/SourceKit/tools/sourcekitd/lib/API/CMakeLists.txt @@ -7,11 +7,16 @@ set(sourcekitdAPI_sources TokenAnnotationsArray.cpp ) -set(sourcekitdAPI_Darwin_sources - sourcekitdAPI-XPC.cpp) -set(LLVM_OPTIONAL_SOURCES ${sourcekitdAPI_Darwin_sources}) -if(APPLE) - list(APPEND sourcekitdAPI_sources ${sourcekitdAPI_Darwin_sources}) +set(sourcekitdAPI_InProc_sources sourcekitdAPI-InProc.cpp) +set(sourcekitdAPI_XPC_sources sourcekitdAPI-XPC.cpp) + +set(LLVM_OPTIONAL_SOURCES ${sourcekitdAPI_InProc_sources}) +set(LLVM_OPTIONAL_SOURCES ${sourcekitdAPI_XPC_sources}) + +if(SWIFT_SOURCEKIT_USE_INPROC_LIBRARY) + list(APPEND sourcekitdAPI_sources ${sourcekitdAPI_InProc_sources}) +else() + list(APPEND sourcekitdAPI_sources ${sourcekitdAPI_XPC_sources}) endif() add_sourcekit_library(sourcekitdAPI diff --git a/tools/SourceKit/tools/sourcekitd/lib/API/sourcekitdAPI-InProc.cpp b/tools/SourceKit/tools/sourcekitd/lib/API/sourcekitdAPI-InProc.cpp new file mode 100644 index 0000000000000..816d60a2084a9 --- /dev/null +++ b/tools/SourceKit/tools/sourcekitd/lib/API/sourcekitdAPI-InProc.cpp @@ -0,0 +1,239 @@ +//===--- sourcekitdAPI-InProc.cpp -----------------------------------------===// +// +// This source file is part of the Swift.org open source project +// +// Copyright (c) 2014 - 2016 Apple Inc. and the Swift project authors +// Licensed under Apache License v2.0 with Runtime Library Exception +// +// See http://swift.org/LICENSE.txt for license information +// See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors +// +//===----------------------------------------------------------------------===// + +#include "sourcekitd/sourcekitd.h" +#include "sourcekitd/Internal.h" +#include "SourceKit/Support/UIdent.h" +#include "llvm/ADT/ArrayRef.h" +#include "llvm/ADT/StringRef.h" +#include "llvm/Support/ErrorHandling.h" + +using namespace SourceKit; +using namespace sourcekitd; +using llvm::ArrayRef; +using llvm::StringRef; +using llvm::raw_ostream; + +// The following functions are declared in sourcekitd/sourcekitd.h. +// These are their "in-process" implementations. + +sourcekitd_uid_t +sourcekitd_uid_get_from_buf(const char *buf, size_t length) { + llvm::report_fatal_error("not yet implemented"); +} + +size_t +sourcekitd_uid_get_length(sourcekitd_uid_t uid) { + llvm::report_fatal_error("not yet implemented"); +} + +const char * +sourcekitd_uid_get_string_ptr(sourcekitd_uid_t uid) { + llvm::report_fatal_error("not yet implemented"); +} + +sourcekitd_object_t +sourcekitd_request_retain(sourcekitd_object_t object) { + llvm::report_fatal_error("not yet implemented"); +} + +void sourcekitd_request_release(sourcekitd_object_t object) { + llvm::report_fatal_error("not yet implemented"); +} + +sourcekitd_object_t +sourcekitd_request_dictionary_create(const sourcekitd_uid_t *keys, + const sourcekitd_object_t *values, + size_t count) { + llvm::report_fatal_error("not yet implemented"); +} + +void +sourcekitd_request_dictionary_set_value(sourcekitd_object_t dict, + sourcekitd_uid_t key, + sourcekitd_object_t value) { + llvm::report_fatal_error("not yet implemented"); +} + +sourcekitd_object_t +sourcekitd_request_array_create(const sourcekitd_object_t *objects, + size_t count) { + llvm::report_fatal_error("not yet implemented"); +} + +void +sourcekitd_request_array_set_value(sourcekitd_object_t array, size_t index, + sourcekitd_object_t value) { + llvm::report_fatal_error("not yet implemented"); +} + +sourcekitd_object_t +sourcekitd_request_int64_create(int64_t val) { + llvm::report_fatal_error("not yet implemented"); +} + +sourcekitd_object_t +sourcekitd_request_string_create(const char *string) { + llvm::report_fatal_error("not yet implemented"); +} + +sourcekitd_object_t +sourcekitd_request_uid_create(sourcekitd_uid_t uid) { + llvm::report_fatal_error("not yet implemented"); +} + +void +sourcekitd_response_dispose(sourcekitd_response_t obj) { + llvm::report_fatal_error("not yet implemented"); +} + +bool +sourcekitd_response_is_error(sourcekitd_response_t obj) { + llvm::report_fatal_error("not yet implemented"); +} + +sourcekitd_error_t +sourcekitd_response_error_get_kind(sourcekitd_response_t obj) { + llvm::report_fatal_error("not yet implemented"); +} + +const char * +sourcekitd_response_error_get_description(sourcekitd_response_t obj) { + llvm::report_fatal_error("not yet implemented"); +} + +sourcekitd_variant_t +sourcekitd_response_get_value(sourcekitd_response_t resp) { + llvm::report_fatal_error("not yet implemented"); +} + +// The following functions are declared in sourcekitd/Internal.h. +// These are their "in-process" implementations. + +void sourcekitd::printRequestObject(sourcekitd_object_t Obj, raw_ostream &OS) { + llvm::report_fatal_error("not yet implemented"); +} + +ResponseBuilder::ResponseBuilder() { + llvm::report_fatal_error("not yet implemented"); +} + +ResponseBuilder::~ResponseBuilder() { + llvm::report_fatal_error("not yet implemented"); +} + +ResponseBuilder::Dictionary ResponseBuilder::getDictionary() { + llvm::report_fatal_error("not yet implemented"); +} + +sourcekitd_response_t ResponseBuilder::createResponse() { + llvm::report_fatal_error("not yet implemented"); +} + +void ResponseBuilder::Dictionary::set(UIdent Key, SourceKit::UIdent UID) { + llvm::report_fatal_error("not yet implemented"); +} + +void ResponseBuilder::Dictionary::set(UIdent Key, sourcekitd_uid_t UID) { + llvm::report_fatal_error("not yet implemented"); +} + +void ResponseBuilder::Dictionary::set(UIdent Key, const char *Str) { + llvm::report_fatal_error("not yet implemented"); +} + +void ResponseBuilder::Dictionary::set(UIdent Key, llvm::StringRef Str) { + llvm::report_fatal_error("not yet implemented"); +} + +void ResponseBuilder::Dictionary::set(UIdent Key, int64_t val) { + llvm::report_fatal_error("not yet implemented"); +} + +void ResponseBuilder::Dictionary::set(SourceKit::UIdent Key, + ArrayRef Strs) { + llvm::report_fatal_error("not yet implemented"); +} + +void ResponseBuilder::Dictionary::setBool(UIdent Key, bool val) { + llvm::report_fatal_error("not yet implemented"); +} + +ResponseBuilder::Dictionary +ResponseBuilder::Dictionary::setDictionary(UIdent Key) { + llvm::report_fatal_error("not yet implemented"); +} + +void ResponseBuilder::Dictionary::setCustomBuffer( + SourceKit::UIdent Key, + CustomBufferKind Kind, std::unique_ptr MemBuf) { + llvm::report_fatal_error("not yet implemented"); +} + +ResponseBuilder::Array +ResponseBuilder::Dictionary::setArray(UIdent Key) { + llvm::report_fatal_error("not yet implemented"); +} + +ResponseBuilder::Dictionary ResponseBuilder::Array::appendDictionary() { + llvm::report_fatal_error("not yet implemented"); +} + +sourcekitd_uid_t RequestDict::getUID(UIdent Key) { + llvm::report_fatal_error("not yet implemented"); +} + + +Optional RequestDict::getString(UIdent Key) { + llvm::report_fatal_error("not yet implemented"); +} + +Optional RequestDict::getDictionary(SourceKit::UIdent Key) { + llvm::report_fatal_error("not yet implemented"); +} + +bool RequestDict::getStringArray(SourceKit::UIdent Key, + llvm::SmallVectorImpl &Arr, + bool isOptional) { + llvm::report_fatal_error("not yet implemented"); +} + +bool RequestDict::getUIDArray(SourceKit::UIdent Key, + llvm::SmallVectorImpl &Arr, + bool isOptional) { + llvm::report_fatal_error("not yet implemented"); +} + +bool RequestDict::dictionaryArrayApply( + SourceKit::UIdent key, llvm::function_ref applier) { + llvm::report_fatal_error("not yet implemented"); +} + +bool RequestDict::getInt64(SourceKit::UIdent Key, int64_t &Val, + bool isOptional) { + llvm::report_fatal_error("not yet implemented"); +} + +sourcekitd_response_t +sourcekitd::createErrorRequestInvalid(const char *Description) { + llvm::report_fatal_error("not yet implemented"); +} + +sourcekitd_response_t +sourcekitd::createErrorRequestFailed(const char *Description) { + llvm::report_fatal_error("not yet implemented"); +} + +sourcekitd_response_t +sourcekitd::createErrorRequestCancelled() { + llvm::report_fatal_error("not yet implemented"); +} diff --git a/tools/SourceKit/tools/sourcekitd/lib/API/sourcekitdAPI-XPC.cpp b/tools/SourceKit/tools/sourcekitd/lib/API/sourcekitdAPI-XPC.cpp index 72ce190202fd6..cbd03b0805a32 100644 --- a/tools/SourceKit/tools/sourcekitd/lib/API/sourcekitdAPI-XPC.cpp +++ b/tools/SourceKit/tools/sourcekitd/lib/API/sourcekitdAPI-XPC.cpp @@ -195,6 +195,10 @@ class SKDObjectPrinter : public SKDObjectVisitor { } // anonymous namespace. +//===----------------------------------------------------------------------===// +// Internal API +//===----------------------------------------------------------------------===// + void sourcekitd::printRequestObject(sourcekitd_object_t Obj, raw_ostream &OS) { if (!Obj) { OS << "<>"; @@ -204,10 +208,6 @@ void sourcekitd::printRequestObject(sourcekitd_object_t Obj, raw_ostream &OS) { SKDObjectPrinter(OS).visit(Obj); } -//===----------------------------------------------------------------------===// -// Internal API -//===----------------------------------------------------------------------===// - ResponseBuilder::ResponseBuilder() { Impl = xpc_dictionary_create(nullptr, nullptr, 0); }