[Basic] hasFeature should succeed for promoted language features

Merge `$<Feature>` and `hasFeature` implementations.
  - `$<Feature>` did not support upcoming language features.
  - `hasFeature` did not support promoted language features and also
    didn't take into account `Options` in `Features.def`.

Remove `Options` entirely, it was always one of three cases:
  - `true`
  - `langOpts.hasFeature`
  - `hasSwiftSwiftParser`

Since `LangOptions::hasFeature` should always be used anyway, it's no
longer necessary. `hasSwiftSwiftParser` can be special cased when adding
the default promoted language features (by removing those features).

Resolves rdar://117917456.
This commit is contained in:
Ben Barham
2024-01-03 17:11:18 -08:00
parent 556a9b1ff2
commit d51c58a6f9
12 changed files with 173 additions and 182 deletions

View File

@@ -153,7 +153,7 @@ struct ASTGenExecutor {
symbolgraphgen::SymbolGraphOptions symbolOpts;
// Enable ASTGen.
langOpts.Features.insert(Feature::ParserASTGen);
langOpts.enableFeature(Feature::ParserASTGen);
std::unique_ptr<ASTContext> ctx(
ASTContext::get(langOpts, typeckOpts, silOpts, searchPathOpts,