[Frontend] Add -print-supported-features option

This is a replacement for `-emit-supported-features` that prints
all of the upcoming/experimental features supported by the compiler
with some additional meta information in JSON format to stdout.
This commit is contained in:
Pavel Yaskevich
2025-04-14 16:57:11 -07:00
parent 7ce06dde2c
commit 55bd906906
9 changed files with 153 additions and 0 deletions

View File

@@ -46,6 +46,7 @@
#include "swift/Basic/PrettyStackTrace.h"
#include "swift/Basic/SourceManager.h"
#include "swift/Basic/Statistic.h"
#include "swift/Basic/SupportedFeatures.h"
#include "swift/Basic/TargetInfo.h"
#include "swift/Basic/UUID.h"
#include "swift/Basic/Version.h"
@@ -2063,6 +2064,11 @@ int swift::performFrontend(ArrayRef<const char *> Args,
return finishDiagProcessing(0, /*verifierEnabled*/ false);
}
if (Invocation.getFrontendOptions().PrintSupportedFeatures) {
swift::features::printSupportedFeatures(llvm::outs());
return finishDiagProcessing(0, /*verifierEnabled*/ false);
}
if (Invocation.getFrontendOptions().RequestedAction ==
FrontendOptions::ActionType::NoneAction) {
Instance->getDiags().diagnose(SourceLoc(),