Files
swift-mirror/include/swift/AST/DeclNodes.def
Jordan Rose 4cdb597b23 Rename VTablePlaceholderDecl to MissingMemberDecl.
As such, we no longer insert two placeholders for initializers that
need two vtable slots; instead we record that in the
MissingMemberDecl. I can see MissingMemberDecl growing to be something
we'd actually show to users, that can be used for other kinds of
declarations that don't have vtable entries, but for now I'm not going
to worry about any of that.
2017-05-10 11:55:55 -06:00

143 lines
4.9 KiB
C++

//===--- DeclNodes.def - Swift Declaration AST Metaprogramming --*- 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
//
//===----------------------------------------------------------------------===//
//
// This file defines macros used for macro-metaprogramming with declarations.
//
//===----------------------------------------------------------------------===//
/// DECL(Id, Parent)
/// If the declaration node is not abstract, its enumerator value is
/// DeclKind::Id. The node's class name is Id##Decl, and the name of
/// its base class (in the Decl hierarchy) is Parent.
/// An abstract declaration node is an abstract base class in the hierarchy;
/// it is never a most-derived type, and it does not have an enumerator in
/// DeclKind.
///
/// Most metaprograms do not care about abstract declarations, so the default
/// is to ignore them.
#ifndef ABSTRACT_DECL
#define ABSTRACT_DECL(Id, Parent)
#endif
/// CONTEXT_DECL(Id, Parent)
/// Used for Decls that are also DeclContexts. The default behavior is to do
/// the same as for Decl.
#ifndef CONTEXT_DECL
#define CONTEXT_DECL(Id, Parent) DECL(Id, Parent)
#endif
/// VALUE_DECL(Id, Parent)
/// Used for subclasses of ValueDecl. The default behavior is to do
/// the same as for Decl.
#ifndef VALUE_DECL
#define VALUE_DECL(Id, Parent) DECL(Id, Parent)
#endif
/// CONTEXT_VALUE_DECL(Id, Parent)
/// Used for subclasses of ValueDecl that are also DeclContexts. The default
/// behavior is to do the same as for ValueDecl.
#ifndef CONTEXT_VALUE_DECL
#define CONTEXT_VALUE_DECL(Id, Parent) VALUE_DECL(Id, Parent)
#endif
/// FUNCTION_DECL(Id, Parent)
/// Used for subclasses of AbstractFunctionDecl. The default behavior is to do
/// the same as for CONTEXT_VALUE_DECL.
#ifndef FUNCTION_DECL
#define FUNCTION_DECL(Id, Parent) CONTEXT_VALUE_DECL(Id, Parent)
#endif
/// OPERATOR_DECL(Id, Parent)
/// Used for subclasses of OperatorDecl. The default behavior is to do
/// the same as for Decl.
#ifndef OPERATOR_DECL
#define OPERATOR_DECL(Id, Parent) DECL(Id, Parent)
#endif
/// NOMINAL_TYPE_DECL(Id, Parent)
/// Used for subclasses of NominalTypeDecl. The default behavior is
/// to do the same as for CONTEXT_VALUE_DECL.
#ifndef NOMINAL_TYPE_DECL
#define NOMINAL_TYPE_DECL(Id, Parent) CONTEXT_VALUE_DECL(Id, Parent)
#endif
/// EXTENSION_DECL(Id, Parent)
/// Used for subclasses of ExtensionDecl. The default behavior is
/// to do the same as for CONTEXT_DECL.
#ifndef EXTENSION_DECL
#define EXTENSION_DECL(Id, Parent) CONTEXT_DECL(Id, Parent)
#endif
/// A convenience for determining the range of declarations. These will always
/// appear immediately after the last member.
#ifndef DECL_RANGE
#define DECL_RANGE(Id, First, Last)
#endif
DECL(Import, Decl)
EXTENSION_DECL(Extension, Decl)
DECL(PatternBinding, Decl)
DECL(EnumCase, Decl)
CONTEXT_DECL(TopLevelCode, Decl)
DECL(IfConfig, Decl)
DECL(PrecedenceGroup, Decl)
DECL(MissingMember, Decl)
ABSTRACT_DECL(Operator, Decl)
OPERATOR_DECL(InfixOperator, OperatorDecl)
OPERATOR_DECL(PrefixOperator, OperatorDecl)
OPERATOR_DECL(PostfixOperator, OperatorDecl)
DECL_RANGE(Operator, InfixOperator, PostfixOperator)
ABSTRACT_DECL(Value, Decl)
ABSTRACT_DECL(Type, ValueDecl)
ABSTRACT_DECL(AbstractTypeParam, TypeDecl)
VALUE_DECL(GenericTypeParam, AbstractTypeParamDecl)
VALUE_DECL(AssociatedType, AbstractTypeParamDecl)
DECL_RANGE(AbstractTypeParam, GenericTypeParam, AssociatedType)
ABSTRACT_DECL(GenericType, TypeDecl)
VALUE_DECL(TypeAlias, GenericTypeDecl)
ABSTRACT_DECL(NominalType, GenericTypeDecl)
NOMINAL_TYPE_DECL(Enum, NominalTypeDecl)
NOMINAL_TYPE_DECL(Struct, NominalTypeDecl)
NOMINAL_TYPE_DECL(Class, NominalTypeDecl)
NOMINAL_TYPE_DECL(Protocol, NominalTypeDecl)
DECL_RANGE(NominalType, Enum, Protocol)
DECL_RANGE(GenericType, TypeAlias, Protocol)
CONTEXT_VALUE_DECL(Module, TypeDecl)
DECL_RANGE(Type, GenericTypeParam, Module)
ABSTRACT_DECL(AbstractStorage, ValueDecl)
VALUE_DECL(Var, AbstractStorageDecl)
VALUE_DECL(Param, VarDecl)
VALUE_DECL(Subscript, AbstractStorageDecl)
DECL_RANGE(AbstractStorage, Var, Subscript)
ABSTRACT_DECL(AbstractFunction, ValueDecl)
FUNCTION_DECL(Constructor, AbstractFunctionDecl)
FUNCTION_DECL(Destructor, AbstractFunctionDecl)
FUNCTION_DECL(Func, AbstractFunctionDecl)
DECL_RANGE(AbstractFunction, Constructor, Func)
VALUE_DECL(EnumElement, ValueDecl)
DECL_RANGE(Value, GenericTypeParam, EnumElement)
#undef NOMINAL_TYPE_DECL
#undef VALUE_DECL
#undef DECL_RANGE
#undef ABSTRACT_DECL
#undef FUNCTION_DECL
#undef CONTEXT_DECL
#undef CONTEXT_VALUE_DECL
#undef EXTENSION_DECL
#undef DECL