mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Merge pull request #30693 from nate-chandler/main-attribute
@main: Attribute to add an entry point to a type.
This commit is contained in:
@@ -272,6 +272,13 @@ bool conflicting(ASTContext &ctx,
|
||||
bool *wouldConflictInSwift5 = nullptr,
|
||||
bool skipProtocolExtensionCheck = false);
|
||||
|
||||
/// The kind of artificial main to generate.
|
||||
enum class ArtificialMainKind : uint8_t {
|
||||
NSApplicationMain,
|
||||
UIApplicationMain,
|
||||
TypeMain,
|
||||
};
|
||||
|
||||
/// Decl - Base class for all declarations in Swift.
|
||||
class alignas(1 << DeclAlignInBits) Decl {
|
||||
protected:
|
||||
@@ -779,6 +786,13 @@ public:
|
||||
|
||||
SourceLoc TrailingSemiLoc;
|
||||
|
||||
/// Returns the appropriate kind of entry point to generate for this class,
|
||||
/// based on its attributes.
|
||||
///
|
||||
/// It is an error to call this on a type that does not have either an
|
||||
/// *ApplicationMain or an main attribute.
|
||||
ArtificialMainKind getArtificialMainKind() const;
|
||||
|
||||
SWIFT_DEBUG_DUMP;
|
||||
SWIFT_DEBUG_DUMPER(dump(const char *filename));
|
||||
void dump(raw_ostream &OS, unsigned Indent = 0) const;
|
||||
@@ -3814,12 +3828,6 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
/// The kind of artificial main to generate for a class.
|
||||
enum class ArtificialMainKind : uint8_t {
|
||||
NSApplicationMain,
|
||||
UIApplicationMain,
|
||||
};
|
||||
|
||||
/// This is the base type for AncestryOptions. Each flag describes possible
|
||||
/// interesting kinds of superclasses that a class may have.
|
||||
enum class AncestryFlags : uint8_t {
|
||||
@@ -4087,13 +4095,6 @@ public:
|
||||
/// the Objective-C runtime.
|
||||
StringRef getObjCRuntimeName(llvm::SmallVectorImpl<char> &buffer) const;
|
||||
|
||||
/// Returns the appropriate kind of entry point to generate for this class,
|
||||
/// based on its attributes.
|
||||
///
|
||||
/// It is an error to call this on a class that does not have a
|
||||
/// *ApplicationMain attribute.
|
||||
ArtificialMainKind getArtificialMainKind() const;
|
||||
|
||||
using NominalTypeDecl::lookupDirect;
|
||||
|
||||
/// Look in this class and its extensions (but not any of its protocols or
|
||||
@@ -6297,6 +6298,8 @@ public:
|
||||
}
|
||||
bool isCallAsFunctionMethod() const;
|
||||
|
||||
bool isMainTypeMainMethod() const;
|
||||
|
||||
SelfAccessKind getSelfAccessKind() const;
|
||||
|
||||
void setSelfAccessKind(SelfAccessKind mod) {
|
||||
|
||||
Reference in New Issue
Block a user