Add AvailabilityMacro feature, kind of

This commit is contained in:
Alejandro Alonso
2023-04-16 15:42:14 -07:00
parent 6aaccf0207
commit bd5d24d558
2 changed files with 22 additions and 0 deletions

View File

@@ -748,6 +748,19 @@ static bool ParseLangArgs(LangOptions &Opts, ArgList &Args,
Opts.Features.insert(*feature);
}
// Hack: In order to support using availability macros in SPM packages, we
// need to be able to use:
// .enableExperimentalFeature("AvailabilityMacro='...'")
// within the package manifest and the feature recognizer can't recognize
// this form of feature, so specially handle it here until features can
// maybe have extra arguments in the future.
auto strRef = StringRef(A->getValue());
if (strRef.startswith("AvailabilityMacro=")) {
auto availability = strRef.split("=").second;
Opts.AvailabilityMacros.push_back(availability.str());
}
}
// Map historical flags over to future features.