@@ -324,6 +324,11 @@ static llvm::cl::opt<bool>
324
324
llvm::cl::desc (" Ignore [always_inline] attribute." ),
325
325
llvm::cl::init(false ));
326
326
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
+
327
332
static void runCommandLineSelectedPasses (SILModule *Module,
328
333
irgen::IRGenModule *IRGenMod) {
329
334
auto &opts = Module->getOptions ();
@@ -433,6 +438,23 @@ int main(int argc, char **argv) {
433
438
Invocation.getDiagnosticOptions ().VerifyMode =
434
439
VerifyMode ? DiagnosticOptions::Verify : DiagnosticOptions::NoVerify;
435
440
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
+
436
458
// Setup the SIL Options.
437
459
SILOptions &SILOpts = Invocation.getSILOptions ();
438
460
SILOpts.InlineThreshold = SILInlineThreshold;
0 commit comments