mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[Macros] Type check user-defined macro plugins (#61861)
Type check user-defined macros plugins with user-provided type signatures. Also, load plugin libraries with `RTLD_LOCAL` instead of `RTLD_GLOBAL` to prevent symbol collision between plugins. `llvm::sys::DynamicLibrary` only supports `RTLD_GLOBAL` so we use the plain `dlopen` instead. This does not work on Windows and needs to be fixed. Friend PR: apple/swift-syntax#1042
This commit is contained in:
@@ -57,4 +57,16 @@ public protocol _CompilerPlugin {
|
||||
localSourceText: UnsafePointer<UInt8>,
|
||||
localSourceTextCount: Int
|
||||
) -> (UnsafePointer<UInt8>?, count: Int)
|
||||
|
||||
/// Returns the generic signature of the plugin.
|
||||
///
|
||||
/// - Returns: A newly allocated buffer containing the generic signature.
|
||||
/// The caller is responsible for managing the memory.
|
||||
static func _genericSignature() -> (UnsafePointer<UInt8>?, count: Int)
|
||||
|
||||
/// Returns the type signature of the plugin.
|
||||
///
|
||||
/// - Returns: A newly allocated buffer containing the type signature. The
|
||||
/// caller is responsible for managing the memory.
|
||||
static func _typeSignature() -> (UnsafePointer<UInt8>, count: Int)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user