mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
This reorganization allows adding attributes that refer to types. I need this for a @_specialize attribute with a type list. PrintOptions.h and other headers depend on these enums. But Attr.h defines a lot of classes that almost never need to be included.
91 lines
2.4 KiB
C++
91 lines
2.4 KiB
C++
//===--- AttrKind.h - Enumerate attribute kinds ----------------*- C++ -*-===//
|
|
//
|
|
// This source file is part of the Swift.org open source project
|
|
//
|
|
// Copyright (c) 2014 - 2016 Apple Inc. and the Swift project authors
|
|
// Licensed under Apache License v2.0 with Runtime Library Exception
|
|
//
|
|
// See http://swift.org/LICENSE.txt for license information
|
|
// See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
//
|
|
// This file defines enumerations related to declaration attributes.
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#ifndef SWIFT_ATTRKIND_H
|
|
#define SWIFT_ATTRKIND_H
|
|
|
|
#include "swift/Config.h"
|
|
#include "llvm/Support/DataTypes.h"
|
|
|
|
namespace swift {
|
|
|
|
/// The associativity of a binary operator.
|
|
enum class Associativity {
|
|
/// Non-associative operators cannot be written next to other
|
|
/// operators with the same precedence. Relational operators are
|
|
/// typically non-associative.
|
|
None,
|
|
|
|
/// Left-associative operators associate to the left if written next
|
|
/// to other left-associative operators of the same precedence.
|
|
Left,
|
|
|
|
/// Right-associative operators associate to the right if written
|
|
/// next to other right-associative operators of the same precedence.
|
|
Right
|
|
};
|
|
|
|
/// The kind of unary operator, if any.
|
|
enum class UnaryOperatorKind : uint8_t {
|
|
None,
|
|
Prefix,
|
|
Postfix
|
|
};
|
|
|
|
/// Access control levels.
|
|
// These are used in diagnostics, so please do not reorder existing values.
|
|
enum class Accessibility : uint8_t {
|
|
/// Private access is limited to the current file.
|
|
Private = 0,
|
|
/// Internal access is limited to the current module.
|
|
Internal,
|
|
/// Public access is not limited.
|
|
Public
|
|
};
|
|
|
|
enum class InlineKind : uint8_t {
|
|
Never = 0,
|
|
Always = 1
|
|
};
|
|
|
|
/// This enum represents the possible values of the @effects attribute.
|
|
/// These values are ordered from the strongest guarantee to the weakest,
|
|
/// so please do not reorder existing values.
|
|
enum class EffectsKind : uint8_t {
|
|
ReadNone,
|
|
ReadOnly,
|
|
ReadWrite,
|
|
Unspecified
|
|
};
|
|
|
|
|
|
enum DeclAttrKind : unsigned {
|
|
#define DECL_ATTR(_, NAME, ...) DAK_##NAME,
|
|
#include "swift/AST/Attr.def"
|
|
DAK_Count
|
|
};
|
|
|
|
// Define enumerators for each type attribute, e.g. TAK_weak.
|
|
enum TypeAttrKind {
|
|
#define TYPE_ATTR(X) TAK_##X,
|
|
#include "swift/AST/Attr.def"
|
|
TAK_Count
|
|
};
|
|
|
|
} // end namespace swift
|
|
|
|
#endif
|