mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
When generating a module interface, emit `#if` around any declarations that are tied to specific, named language features. This allows module interfaces to be processed by older Swift compilers that do not support these newer features, such as async/await or actors. The amount of effort required to correctly handle a new kind of feature varies somewhat drastically based on the feature itself. The "simple" case is where a particular declaration can only exist if a feature is available. For example, and `async` declaration is fairly easy to handle; a `@_marker` protocol's conformances are not. Fixes rdar://73326633.
35 lines
1001 B
C++
35 lines
1001 B
C++
//===--- Feature.h - Helpers related to Swift features ----------*- C++ -*-===//
|
|
//
|
|
// This source file is part of the Swift.org open source project
|
|
//
|
|
// Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
|
|
// Licensed under Apache License v2.0 with Runtime Library Exception
|
|
//
|
|
// See https://swift.org/LICENSE.txt for license information
|
|
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#ifndef SWIFT_BASIC_FEATURES_H
|
|
#define SWIFT_BASIC_FEATURES_H
|
|
|
|
#include "llvm/ADT/StringRef.h"
|
|
|
|
namespace swift {
|
|
|
|
class LangOptions;
|
|
|
|
/// Enumeration describing all of the named features.
|
|
enum class Feature {
|
|
#define LANGUAGE_FEATURE(FeatureName, SENumber, Description, Option) \
|
|
FeatureName,
|
|
#include "swift/Basic/Features.def"
|
|
};
|
|
|
|
/// Determine the in-source name of the given feature.
|
|
llvm::StringRef getFeatureName(Feature feature);
|
|
|
|
}
|
|
|
|
#endif // SWIFT_BASIC_FEATURES_H
|