Files
swift-mirror/tools/SourceKit/tools/sourcekitd/lib/API/RawData.cpp
Alex Hoppen b6c94aecc3 [SourceKit] Add mechanism to load plugins for request handling into SourceKit
This allows us to load plugins into the sourcekitd service to handle requests (currently only used for code completion). This allows us to implement parts of sourcekitd in Swift and outside of the compiler repository, making it easier to iterated on them because the compiler doesn’t need to be rebuilt.
2025-01-03 15:24:52 +01:00

63 lines
2.0 KiB
C++

//===--- RawData.cpp ------------------------------------------------------===//
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2018 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
//
//===----------------------------------------------------------------------===//
#include "sourcekitd/RawData.h"
using namespace sourcekitd;
struct RawDataFuncs {
static sourcekitd_variant_type_t get_type(sourcekitd_variant_t var) {
return SOURCEKITD_VARIANT_TYPE_DATA;
}
static size_t data_get_size(sourcekitd_variant_t variant) {
return variant.data[2];
}
static const void *data_get_ptr(sourcekitd_variant_t variant) {
return reinterpret_cast<void *>(variant.data[1]);
}
static VariantFunctions Funcs;
};
VariantFunctions RawDataFuncs::Funcs = {
get_type,
nullptr /*AnnotArray_array_apply*/,
nullptr /*AnnotArray_array_get_bool*/,
nullptr /*AnnotArray_array_get_double*/,
nullptr /*Annot_array_array_get_count*/,
nullptr /*AnnotArray_array_get_int64*/,
nullptr /*AnnotArray_array_get_string*/,
nullptr /*AnnotArray_array_get_uid*/,
nullptr /*AnnotArray_array_get_value*/,
nullptr /*AnnotArray_bool_get_value*/,
nullptr /*AnnotArray_double_get_value*/,
nullptr /*AnnotArray_dictionary_apply*/,
nullptr /*AnnotArray_dictionary_get_bool*/,
nullptr /*AnnotArray_dictionary_get_double*/,
nullptr /*AnnotArray_dictionary_get_int64*/,
nullptr /*AnnotArray_dictionary_get_string*/,
nullptr /*AnnotArray_dictionary_get_value*/,
nullptr /*AnnotArray_dictionary_get_uid*/,
nullptr /*AnnotArray_string_get_length*/,
nullptr /*AnnotArray_string_get_ptr*/,
nullptr /*AnnotArray_int64_get_value*/,
nullptr /*AnnotArray_uid_get_value*/,
data_get_size,
data_get_ptr,
};
VariantFunctions *sourcekitd::getVariantFunctionsForRawData() {
return &RawDataFuncs::Funcs;
}