@@ -324,6 +324,11 @@ static llvm::cl::opt<bool>
324324 llvm::cl::desc (" Ignore [always_inline] attribute." ),
325325 llvm::cl::init(false ));
326326
327+ static llvm::cl::opt<std::string> EnableRequirementMachine (
328+ " requirement-machine" ,
329+ llvm::cl::desc (" Control usage of experimental generics implementation: "
330+ " 'on', 'off', or 'verify'." ));
331+
327332static void runCommandLineSelectedPasses (SILModule *Module,
328333 irgen::IRGenModule *IRGenMod) {
329334 auto &opts = Module->getOptions ();
@@ -433,6 +438,23 @@ int main(int argc, char **argv) {
433438 Invocation.getDiagnosticOptions ().VerifyMode =
434439 VerifyMode ? DiagnosticOptions::Verify : DiagnosticOptions::NoVerify;
435440
441+ if (EnableRequirementMachine.size ()) {
442+ auto value = llvm::StringSwitch<Optional<RequirementMachineMode>>(
443+ EnableRequirementMachine)
444+ .Case (" off" , RequirementMachineMode::Disabled)
445+ .Case (" on" , RequirementMachineMode::Enabled)
446+ .Case (" verify" , RequirementMachineMode::Verify)
447+ .Default (None);
448+
449+ if (value)
450+ Invocation.getLangOptions ().EnableRequirementMachine = *value;
451+ else {
452+ fprintf (stderr, " Invalid value for -requirement-machine flag: %s\n " ,
453+ EnableRequirementMachine.c_str ());
454+ exit (-1 );
455+ }
456+ }
457+
436458 // Setup the SIL Options.
437459 SILOptions &SILOpts = Invocation.getSILOptions ();
438460 SILOpts.InlineThreshold = SILInlineThreshold;
0 commit comments