|
2 | 2 | // |
3 | 3 | // This source file is part of the Swift.org open source project |
4 | 4 | // |
5 | | -// Copyright (c) 2014 - 2023 Apple Inc. and the Swift project authors |
| 5 | +// Copyright (c) 2014 - 2025 Apple Inc. and the Swift project authors |
6 | 6 | // Licensed under Apache License v2.0 with Runtime Library Exception |
7 | 7 | // |
8 | 8 | // See https://swift.org/LICENSE.txt for license information |
@@ -620,75 +620,6 @@ std::pair<bool, bool> LangOptions::setTarget(llvm::Triple triple) { |
620 | 620 | return { false, false }; |
621 | 621 | } |
622 | 622 |
|
623 | | -llvm::StringRef swift::getFeatureName(Feature feature) { |
624 | | - switch (feature) { |
625 | | -#define LANGUAGE_FEATURE(FeatureName, SENumber, Description) \ |
626 | | - case Feature::FeatureName: \ |
627 | | - return #FeatureName; |
628 | | -#include "swift/Basic/Features.def" |
629 | | - } |
630 | | - llvm_unreachable("covered switch"); |
631 | | -} |
632 | | - |
633 | | -bool swift::isFeatureAvailableInProduction(Feature feature) { |
634 | | - switch (feature) { |
635 | | -#define LANGUAGE_FEATURE(FeatureName, SENumber, Description) \ |
636 | | - case Feature::FeatureName: \ |
637 | | - return true; |
638 | | -#define EXPERIMENTAL_FEATURE(FeatureName, AvailableInProd) \ |
639 | | - case Feature::FeatureName: return AvailableInProd; |
640 | | -#define OPTIONAL_LANGUAGE_FEATURE(FeatureName, SENumber, Description) \ |
641 | | - LANGUAGE_FEATURE(FeatureName, SENumber, Description) |
642 | | -#include "swift/Basic/Features.def" |
643 | | - } |
644 | | - llvm_unreachable("covered switch"); |
645 | | -} |
646 | | - |
647 | | -std::optional<Feature> swift::getUpcomingFeature(llvm::StringRef name) { |
648 | | - return llvm::StringSwitch<std::optional<Feature>>(name) |
649 | | -#define LANGUAGE_FEATURE(FeatureName, SENumber, Description) |
650 | | -#define UPCOMING_FEATURE(FeatureName, SENumber, Version) \ |
651 | | - .Case(#FeatureName, Feature::FeatureName) |
652 | | -#include "swift/Basic/Features.def" |
653 | | - .Default(std::nullopt); |
654 | | -} |
655 | | - |
656 | | -std::optional<Feature> swift::getExperimentalFeature(llvm::StringRef name) { |
657 | | - return llvm::StringSwitch<std::optional<Feature>>(name) |
658 | | -#define LANGUAGE_FEATURE(FeatureName, SENumber, Description) |
659 | | -#define EXPERIMENTAL_FEATURE(FeatureName, AvailableInProd) \ |
660 | | - .Case(#FeatureName, Feature::FeatureName) |
661 | | -#define OPTIONAL_LANGUAGE_FEATURE(FeatureName, SENumber, Description) |
662 | | -#include "swift/Basic/Features.def" |
663 | | - .Default(std::nullopt); |
664 | | -} |
665 | | - |
666 | | -std::optional<unsigned> swift::getFeatureLanguageVersion(Feature feature) { |
667 | | - switch (feature) { |
668 | | -#define LANGUAGE_FEATURE(FeatureName, SENumber, Description) |
669 | | -#define UPCOMING_FEATURE(FeatureName, SENumber, Version) \ |
670 | | - case Feature::FeatureName: return Version; |
671 | | -#define OPTIONAL_LANGUAGE_FEATURE(FeatureName, SENumber, Description) |
672 | | -#include "swift/Basic/Features.def" |
673 | | - default: |
674 | | - return std::nullopt; |
675 | | - } |
676 | | -} |
677 | | - |
678 | | -bool swift::includeInModuleInterface(Feature feature) { |
679 | | - switch (feature) { |
680 | | -#define LANGUAGE_FEATURE(FeatureName, SENumber, Description) \ |
681 | | - case Feature::FeatureName: \ |
682 | | - return true; |
683 | | -#define EXPERIMENTAL_FEATURE_EXCLUDED_FROM_MODULE_INTERFACE(FeatureName, AvailableInProd) \ |
684 | | - case Feature::FeatureName: return false; |
685 | | -#define OPTIONAL_LANGUAGE_FEATURE(FeatureName, SENumber, Description) \ |
686 | | - LANGUAGE_FEATURE(FeatureName, SENumber, Description) |
687 | | -#include "swift/Basic/Features.def" |
688 | | - } |
689 | | - llvm_unreachable("covered switch"); |
690 | | -} |
691 | | - |
692 | 623 | llvm::StringRef swift::getPlaygroundOptionName(PlaygroundOption option) { |
693 | 624 | switch (option) { |
694 | 625 | #define PLAYGROUND_OPTION(OptionName, Description, DefaultOn, HighPerfOn) \ |
|
0 commit comments