mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Merge remote-tracking branch 'origin/main' into rebranch
This commit is contained in:
@@ -51,7 +51,9 @@ else()
|
||||
endif()
|
||||
target_link_libraries(sourcekitdInProc PRIVATE
|
||||
SourceKitSwiftLang
|
||||
sourcekitdAPI)
|
||||
sourcekitdAPI
|
||||
sourcekitdService
|
||||
swiftIDETool)
|
||||
|
||||
# While it is possible to build this as a static library,
|
||||
# to get the runtime paths correct, it must be linked into a binary
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "sourcekitd/Internal.h"
|
||||
#include "sourcekitd/Service.h"
|
||||
|
||||
#include "SourceKit/Support/Concurrency.h"
|
||||
#include "SourceKit/Support/Logging.h"
|
||||
|
||||
@@ -10,7 +10,8 @@ if (BUILD_SOURCEKIT_XPC_SERVICE)
|
||||
else()
|
||||
target_link_libraries(SourceKitService PRIVATE
|
||||
SourceKitSwiftLang
|
||||
sourcekitdAPI)
|
||||
sourcekitdAPI
|
||||
sourcekitdService)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
|
||||
#include "sourcekitd/Internal-XPC.h"
|
||||
#include "sourcekitd/Logging.h"
|
||||
#include "sourcekitd/Service.h"
|
||||
|
||||
#include "SourceKit/Core/LLVM.h"
|
||||
#include "SourceKit/Support/Concurrency.h"
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
//
|
||||
// This source file is part of the Swift.org open source project
|
||||
//
|
||||
// Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
|
||||
// Copyright (c) 2014 - 2022 Apple Inc. and the Swift project authors
|
||||
// Licensed under Apache License v2.0 with Runtime Library Exception
|
||||
//
|
||||
// See https://swift.org/LICENSE.txt for license information
|
||||
@@ -153,19 +153,6 @@ public:
|
||||
Optional<int64_t> getOptionalInt64(SourceKit::UIdent Key);
|
||||
};
|
||||
|
||||
/// Initialize the service. Must be called before attempting to handle requests.
|
||||
/// \param swiftExecutablePath The path of the swift-frontend executable.
|
||||
/// Used to find clang relative to it.
|
||||
/// \param runtimeLibPath The path to the toolchain's library directory.
|
||||
/// \param diagnosticDocumentationPath The path to diagnostics documentation.
|
||||
/// \param postNotification Callback to post a notification.
|
||||
void initializeService(
|
||||
llvm::StringRef swiftExecutablePath, llvm::StringRef runtimeLibPath,
|
||||
llvm::StringRef diagnosticDocumentationPath,
|
||||
std::function<void(sourcekitd_response_t)> postNotification);
|
||||
/// Shutdown the service.
|
||||
void shutdownService();
|
||||
|
||||
/// Initialize the sourcekitd client library. Returns true if this is the first
|
||||
/// time it is initialized.
|
||||
bool initializeClient();
|
||||
@@ -175,16 +162,6 @@ bool shutdownClient();
|
||||
|
||||
void set_interrupted_connection_handler(llvm::function_ref<void()> handler);
|
||||
|
||||
typedef std::function<void(sourcekitd_response_t)> ResponseReceiver;
|
||||
|
||||
void handleRequest(sourcekitd_object_t Request,
|
||||
SourceKitCancellationToken CancellationToken,
|
||||
ResponseReceiver Receiver);
|
||||
|
||||
void cancelRequest(SourceKitCancellationToken CancellationToken);
|
||||
|
||||
void disposeCancellationToken(SourceKitCancellationToken CancellationToken);
|
||||
|
||||
void printRequestObject(sourcekitd_object_t Obj, llvm::raw_ostream &OS);
|
||||
void printResponse(sourcekitd_response_t Resp, llvm::raw_ostream &OS);
|
||||
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
//===--- Service.h - --------------------------------------------*- C++ -*-===//
|
||||
//
|
||||
// This source file is part of the Swift.org open source project
|
||||
//
|
||||
// Copyright (c) 2014 - 2022 Apple Inc. and the Swift project authors
|
||||
// Licensed under Apache License v2.0 with Runtime Library Exception
|
||||
//
|
||||
// See https://swift.org/LICENSE.txt for license information
|
||||
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef LLVM_SOURCEKITD_SERVICE_H
|
||||
#define LLVM_SOURCEKITD_SERVICE_H
|
||||
|
||||
#include "SourceKit/Support/CancellationToken.h"
|
||||
#include "sourcekitd/sourcekitd.h"
|
||||
#include "llvm/ADT/StringRef.h"
|
||||
|
||||
#include <functional>
|
||||
|
||||
namespace sourcekitd {
|
||||
using SourceKit::SourceKitCancellationToken;
|
||||
|
||||
/// Initialize the service. Must be called before attempting to handle requests.
|
||||
/// \param swiftExecutablePath The path of the swift-frontend executable.
|
||||
/// Used to find clang relative to it.
|
||||
/// \param runtimeLibPath The path to the toolchain's library directory.
|
||||
/// \param diagnosticDocumentationPath The path to diagnostics documentation.
|
||||
/// \param postNotification Callback to post a notification.
|
||||
void initializeService(
|
||||
llvm::StringRef swiftExecutablePath, llvm::StringRef runtimeLibPath,
|
||||
llvm::StringRef diagnosticDocumentationPath,
|
||||
std::function<void(sourcekitd_response_t)> postNotification);
|
||||
/// Shutdown the service.
|
||||
void shutdownService();
|
||||
|
||||
typedef std::function<void(sourcekitd_response_t)> ResponseReceiver;
|
||||
|
||||
void handleRequest(sourcekitd_object_t Request,
|
||||
SourceKitCancellationToken CancellationToken,
|
||||
ResponseReceiver Receiver);
|
||||
|
||||
void cancelRequest(SourceKitCancellationToken CancellationToken);
|
||||
|
||||
void disposeCancellationToken(SourceKitCancellationToken CancellationToken);
|
||||
|
||||
} // namespace sourcekitd
|
||||
|
||||
#endif // LLVM_SOURCEKITD_SERVICE_H
|
||||
@@ -8,18 +8,15 @@ add_sourcekit_library(sourcekitdAPI
|
||||
DocStructureArray.cpp
|
||||
DocSupportAnnotationArray.cpp
|
||||
RawData.cpp
|
||||
Requests.cpp
|
||||
sourcekitdAPI-Common.cpp
|
||||
TokenAnnotationsArray.cpp
|
||||
ExpressionTypeArray.cpp
|
||||
VariableTypeArray.cpp
|
||||
UIDHandling.cpp
|
||||
)
|
||||
UIDHandling.cpp)
|
||||
|
||||
target_link_libraries(sourcekitdAPI PRIVATE
|
||||
swiftBasic
|
||||
SourceKitSupport
|
||||
SourceKitSwiftLang
|
||||
swiftCompilerModules)
|
||||
SourceKitSupport)
|
||||
|
||||
if(APPLE AND HAVE_XPC_H)
|
||||
target_sources(sourcekitdAPI PRIVATE
|
||||
|
||||
@@ -12,9 +12,9 @@
|
||||
|
||||
#include "sourcekitd/CodeCompletionResultsArray.h"
|
||||
#include "sourcekitd/CompactArray.h"
|
||||
#include "sourcekitd/DictionaryKeys.h"
|
||||
#include "SourceKit/Core/LLVM.h"
|
||||
#include "SourceKit/Support/UIdent.h"
|
||||
#include "DictionaryKeys.h"
|
||||
|
||||
#include "llvm/Support/MemoryBuffer.h"
|
||||
|
||||
|
||||
@@ -11,10 +11,10 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "sourcekitd/DocStructureArray.h"
|
||||
#include "DictionaryKeys.h"
|
||||
#include "sourcekitd/CompactArray.h"
|
||||
#include "sourcekitd/DictionaryKeys.h"
|
||||
#include "SourceKit/Core/LLVM.h"
|
||||
#include "SourceKit/Support/UIdent.h"
|
||||
#include "sourcekitd/CompactArray.h"
|
||||
#include "llvm/ADT/ArrayRef.h"
|
||||
#include "llvm/Support/MemoryBuffer.h"
|
||||
#include "llvm/Support/raw_ostream.h"
|
||||
|
||||
@@ -11,11 +11,11 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "sourcekitd/DocSupportAnnotationArray.h"
|
||||
#include "sourcekitd/DictionaryKeys.h"
|
||||
#include "sourcekitd/CompactArray.h"
|
||||
#include "SourceKit/Core/LangSupport.h"
|
||||
#include "llvm/Support/MemoryBuffer.h"
|
||||
|
||||
#include "DictionaryKeys.h"
|
||||
|
||||
using namespace SourceKit;
|
||||
using namespace sourcekitd;
|
||||
|
||||
@@ -12,10 +12,10 @@
|
||||
|
||||
#include "sourcekitd/ExpressionTypeArray.h"
|
||||
#include "sourcekitd/CompactArray.h"
|
||||
#include "sourcekitd/DictionaryKeys.h"
|
||||
#include "SourceKit/Core/LLVM.h"
|
||||
#include "SourceKit/Core/LangSupport.h"
|
||||
#include "SourceKit/Support/UIdent.h"
|
||||
#include "DictionaryKeys.h"
|
||||
|
||||
#include "llvm/Support/MemoryBuffer.h"
|
||||
|
||||
|
||||
@@ -12,9 +12,9 @@
|
||||
|
||||
#include "sourcekitd/TokenAnnotationsArray.h"
|
||||
#include "sourcekitd/CompactArray.h"
|
||||
#include "sourcekitd/DictionaryKeys.h"
|
||||
#include "SourceKit/Core/LLVM.h"
|
||||
#include "SourceKit/Support/UIdent.h"
|
||||
#include "DictionaryKeys.h"
|
||||
|
||||
#include "llvm/Support/MemoryBuffer.h"
|
||||
|
||||
|
||||
@@ -12,10 +12,10 @@
|
||||
|
||||
#include "sourcekitd/VariableTypeArray.h"
|
||||
#include "sourcekitd/CompactArray.h"
|
||||
#include "sourcekitd/DictionaryKeys.h"
|
||||
#include "SourceKit/Core/LLVM.h"
|
||||
#include "SourceKit/Core/LangSupport.h"
|
||||
#include "SourceKit/Support/UIdent.h"
|
||||
#include "DictionaryKeys.h"
|
||||
|
||||
#include "llvm/Support/MemoryBuffer.h"
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "DictionaryKeys.h"
|
||||
#include "sourcekitd/DictionaryKeys.h"
|
||||
#include "sourcekitd/Internal.h"
|
||||
#include "sourcekitd/Logging.h"
|
||||
#include "sourcekitd/RequestResponsePrinterBase.h"
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "DictionaryKeys.h"
|
||||
#include "sourcekitd/DictionaryKeys.h"
|
||||
#include "sourcekitd/Internal.h"
|
||||
#include "sourcekitd/CodeCompletionResultsArray.h"
|
||||
#include "sourcekitd/DocStructureArray.h"
|
||||
|
||||
@@ -10,8 +10,8 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "DictionaryKeys.h"
|
||||
#include "sourcekitd/CodeCompletionResultsArray.h"
|
||||
#include "sourcekitd/DictionaryKeys.h"
|
||||
#include "sourcekitd/DocStructureArray.h"
|
||||
#include "sourcekitd/DocSupportAnnotationArray.h"
|
||||
#include "sourcekitd/TokenAnnotationsArray.h"
|
||||
|
||||
@@ -1 +1,2 @@
|
||||
add_subdirectory(API)
|
||||
add_subdirectory(Service)
|
||||
|
||||
10
tools/SourceKit/tools/sourcekitd/lib/Service/CMakeLists.txt
Normal file
10
tools/SourceKit/tools/sourcekitd/lib/Service/CMakeLists.txt
Normal file
@@ -0,0 +1,10 @@
|
||||
|
||||
add_sourcekit_library(sourcekitdService
|
||||
Requests.cpp
|
||||
)
|
||||
target_link_libraries(sourcekitdService PRIVATE
|
||||
sourcekitdAPI
|
||||
swiftBasic
|
||||
SourceKitSupport
|
||||
SourceKitSwiftLang
|
||||
swiftCompilerModules)
|
||||
@@ -10,8 +10,9 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "DictionaryKeys.h"
|
||||
#include "sourcekitd/Service.h"
|
||||
#include "sourcekitd/CodeCompletionResultsArray.h"
|
||||
#include "sourcekitd/DictionaryKeys.h"
|
||||
#include "sourcekitd/DocStructureArray.h"
|
||||
#include "sourcekitd/DocSupportAnnotationArray.h"
|
||||
#include "sourcekitd/TokenAnnotationsArray.h"
|
||||
Reference in New Issue
Block a user