Skip to content

Commit f0fc1c5

Browse files
committed
Remove compiler plugin support library
The functionality of the compiler plugin support library has been subsumed into parts of the compiler. Remove the functionality and its last test.
1 parent 14aebca commit f0fc1c5

19 files changed

+20
-847
lines changed

include/swift/AST/ASTContext.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,6 @@ namespace swift {
132132
class IndexSubset;
133133
struct SILAutoDiffDerivativeFunctionKey;
134134
struct InterfaceSubContextDelegate;
135-
class CompilerPlugin;
136135

137136
enum class KnownProtocolKind : uint8_t;
138137

include/swift/AST/CompilerPlugin.h

Lines changed: 0 additions & 106 deletions
This file was deleted.

include/swift/AST/Decl.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8282,11 +8282,12 @@ class MissingMemberDecl : public Decl {
82828282

82838283
/// Provides a declaration of a macro.
82848284
///
8285+
/// Macros are declared within the source code with the `macro` introducer.
8286+
///
82858287
/// Macros are defined externally via conformances to the 'Macro' type
82868288
/// that is part of swift-syntax, and are introduced into the compiler via
8287-
/// various mechanisms (built-in macros are linked in directly, plugin macros
8288-
/// are introduced via compiler plugins, and so on). They have no explicit
8289-
/// representation in the source code, but are still declarations.
8289+
/// various mechanisms (e.g., in-process macros provided as builtins or
8290+
/// loaded via shared library, and so on).
82908291
class MacroDecl : public GenericContext, public ValueDecl {
82918292
public:
82928293
/// The location of the 'macro' keyword.

include/swift/AST/KnownIdentifiers.def

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -333,9 +333,6 @@ IDENTIFIER(unsafe)
333333
// The singleton instance of TupleTypeDecl in the Builtin module
334334
IDENTIFIER(TheTupleType)
335335

336-
// Macros / compiler plugins
337-
IDENTIFIER_(CompilerPluginSupport)
338-
339336
#undef IDENTIFIER
340337
#undef IDENTIFIER_
341338
#undef IDENTIFIER_WITH_NAME

include/swift/AST/KnownProtocols.def

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -116,9 +116,6 @@ PROTOCOL(AsyncIteratorProtocol)
116116

117117
PROTOCOL(FloatingPoint)
118118

119-
// Compiler Plugins
120-
PROTOCOL_(CompilerPlugin)
121-
122119
EXPRESSIBLE_BY_LITERAL_PROTOCOL(ExpressibleByArrayLiteral, "Array", false)
123120
EXPRESSIBLE_BY_LITERAL_PROTOCOL(ExpressibleByBooleanLiteral, "BooleanLiteralType", true)
124121
EXPRESSIBLE_BY_LITERAL_PROTOCOL(ExpressibleByDictionaryLiteral, "Dictionary", false)

include/swift/AST/MacroDefinition.h

Lines changed: 8 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@
2222

2323
namespace swift {
2424

25-
class CompilerPlugin;
26-
2725
/// Provides the definition of a macro.
2826
struct MacroDefinition {
2927
/// The kind of macro, which determines how it can be used in source code.
@@ -34,12 +32,9 @@ struct MacroDefinition {
3432

3533
/// Describes how the macro is implemented.
3634
enum class ImplementationKind: uint8_t {
37-
/// The macro is built-in to the compiler, linked against the same
38-
/// underlying syntax tree libraries.
39-
Builtin,
40-
41-
/// The macro was defined in a compiler plugin.
42-
Plugin,
35+
/// The macro is in the same process as the compiler, whether built-in or
36+
/// loaded via a compiler plugin.
37+
InProcess,
4338
};
4439

4540
public:
@@ -55,39 +50,22 @@ struct MacroDefinition {
5550
public:
5651
static MacroDefinition forInvalid() {
5752
return MacroDefinition{
58-
Kind::Expression, ImplementationKind::Builtin, nullptr
53+
Kind::Expression, ImplementationKind::InProcess, nullptr
5954
};
6055
}
6156

62-
static MacroDefinition forBuiltin(Kind kind, void *opaqueHandle) {
63-
return MacroDefinition{kind, ImplementationKind::Builtin, opaqueHandle};
64-
}
65-
66-
static MacroDefinition forCompilerPlugin(Kind kind, CompilerPlugin *plugin) {
67-
return MacroDefinition{kind, ImplementationKind::Plugin, plugin};
57+
static MacroDefinition forInProcess(Kind kind, void *opaqueHandle) {
58+
return MacroDefinition{kind, ImplementationKind::InProcess, opaqueHandle};
6859
}
6960

7061
bool isInvalid() const { return opaqueHandle == nullptr; }
7162

7263
explicit operator bool() const { return !isInvalid(); }
7364

74-
void *getAsBuiltin() const {
65+
void *getAsInProcess() const {
7566
switch (implKind) {
76-
case ImplementationKind::Builtin:
67+
case ImplementationKind::InProcess:
7768
return opaqueHandle;
78-
79-
case ImplementationKind::Plugin:
80-
return nullptr;
81-
}
82-
}
83-
84-
CompilerPlugin *getAsCompilerPlugin() const {
85-
switch (implKind) {
86-
case ImplementationKind::Builtin:
87-
return nullptr;
88-
89-
case ImplementationKind::Plugin:
90-
return (CompilerPlugin *)opaqueHandle;
9169
}
9270
}
9371
};

lib/AST/ASTContext.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
#include "ForeignRepresentationInfo.h"
2020
#include "SubstitutionMapStorage.h"
2121
#include "swift/AST/ClangModuleLoader.h"
22-
#include "swift/AST/CompilerPlugin.h"
2322
#include "swift/AST/ConcreteDeclRef.h"
2423
#include "swift/AST/DiagnosticEngine.h"
2524
#include "swift/AST/DiagnosticsFrontend.h"
@@ -1125,9 +1124,6 @@ ProtocolDecl *ASTContext::getProtocol(KnownProtocolKind kind) const {
11251124
case KnownProtocolKind::UnsafeCxxRandomAccessIterator:
11261125
M = getLoadedModule(Id_Cxx);
11271126
break;
1128-
case KnownProtocolKind::CompilerPlugin:
1129-
M = getLoadedModule(Id_CompilerPluginSupport);
1130-
break;
11311127
default:
11321128
M = getStdlibModule();
11331129
break;

lib/AST/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ add_swift_host_library(swiftAST STATIC
3333
CaptureInfo.cpp
3434
ClangSwiftTypeCorrespondence.cpp
3535
ClangTypeConverter.cpp
36-
CompilerPlugin.cpp
3736
ConcreteDeclRef.cpp
3837
ConformanceLookupTable.cpp
3938
Decl.cpp

0 commit comments

Comments
 (0)