mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[ModuleInterface] Add mechanism to exclude experimental flags from th… (#66088)
* [ModuleInterface] Add mechanism to exclude experimental flags from the module interface rdar://109722548 * Separate filtered flags from the typical/unfiltered case
This commit is contained in:
@@ -417,6 +417,19 @@ static void ParseModuleInterfaceArgs(ModuleInterfaceOptions &Opts,
|
||||
}
|
||||
}
|
||||
|
||||
/// Checks if an arg is generally allowed to be included
|
||||
/// in a module interface
|
||||
static bool ShouldIncludeModuleInterfaceArg(const Arg *A) {
|
||||
if (!A->getOption().matches(options::OPT_enable_experimental_feature))
|
||||
return true;
|
||||
|
||||
if (auto feature = getExperimentalFeature(A->getValue())) {
|
||||
return swift::includeInModuleInterface(*feature);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/// Save a copy of any flags marked as ModuleInterfaceOption, if running
|
||||
/// in a mode that is going to emit a .swiftinterface file.
|
||||
static void SaveModuleInterfaceArgs(ModuleInterfaceOptions &Opts,
|
||||
@@ -428,6 +441,9 @@ static void SaveModuleInterfaceArgs(ModuleInterfaceOptions &Opts,
|
||||
ArgStringList RenderedArgsIgnorable;
|
||||
ArgStringList RenderedArgsIgnorablePrivate;
|
||||
for (auto A : Args) {
|
||||
if (!ShouldIncludeModuleInterfaceArg(A))
|
||||
continue;
|
||||
|
||||
if (A->getOption().hasFlag(options::ModuleInterfaceOptionIgnorablePrivate)) {
|
||||
A->render(Args, RenderedArgsIgnorablePrivate);
|
||||
} else if (A->getOption().hasFlag(options::ModuleInterfaceOptionIgnorable)) {
|
||||
|
||||
Reference in New Issue
Block a user