|
21 | 21 | #include "swift/Basic/FileTypes.h"
|
22 | 22 | #include "swift/Basic/LLVMInitialize.h"
|
23 | 23 | #include "swift/Basic/InitializeSwiftModules.h"
|
| 24 | +#include "swift/Basic/QuotedString.h" |
24 | 25 | #include "swift/Frontend/DiagnosticVerifier.h"
|
25 | 26 | #include "swift/Frontend/Frontend.h"
|
26 | 27 | #include "swift/Frontend/PrintingDiagnosticConsumer.h"
|
@@ -113,6 +114,10 @@ static llvm::cl::opt<bool>
|
113 | 114 | DisableObjCInterop("disable-objc-interop",
|
114 | 115 | llvm::cl::desc("Disable Objective-C interoperability."));
|
115 | 116 |
|
| 117 | +static llvm::cl::list<std::string> |
| 118 | +ExperimentalFeatures("enable-experimental-feature", |
| 119 | + llvm::cl::desc("Enable the given experimental feature.")); |
| 120 | + |
116 | 121 | static llvm::cl::opt<bool>
|
117 | 122 | EnableExperimentalConcurrency("enable-experimental-concurrency",
|
118 | 123 | llvm::cl::desc("Enable experimental concurrency model."));
|
@@ -572,6 +577,15 @@ int main(int argc, char **argv) {
|
572 | 577 | toOptionalBool(EnableExperimentalMoveOnly);
|
573 | 578 | if (enableExperimentalMoveOnly && *enableExperimentalMoveOnly)
|
574 | 579 | Invocation.getLangOptions().Features.insert(Feature::MoveOnly);
|
| 580 | + for (auto &featureName : ExperimentalFeatures) { |
| 581 | + if (auto feature = getExperimentalFeature(featureName)) { |
| 582 | + Invocation.getLangOptions().Features.insert(*feature); |
| 583 | + } else { |
| 584 | + llvm::errs() << "error: unknown feature " |
| 585 | + << QuotedString(featureName) << "\n"; |
| 586 | + exit(-1); |
| 587 | + } |
| 588 | + } |
575 | 589 |
|
576 | 590 | Invocation.getLangOptions().EnableObjCInterop =
|
577 | 591 | EnableObjCInterop ? true :
|
|
0 commit comments