//===--- Attr.def - Swift Attributes Metaprogramming ------------*- C++ -*-===// // // This source file is part of the Swift.org open source project // // Copyright (c) 2014 - 2015 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 macros used for macro-metaprogramming with attributes. // //===----------------------------------------------------------------------===// #ifndef ATTR #define ATTR(X) #endif #ifndef DECL_ATTR #define DECL_ATTR(X, ...) #endif #ifndef TYPE_ATTR #define TYPE_ATTR(X) #endif #ifndef IB_ATTR #define IB_ATTR(X) ATTR(X) #endif #ifndef VIRTUAL_ATTR #define VIRTUAL_ATTR(X) ATTR(X) #endif // Type attributes TYPE_ATTR(auto_closure) TYPE_ATTR(cc) TYPE_ATTR(noreturn) TYPE_ATTR(objc_block) TYPE_ATTR(thin) TYPE_ATTR(thick) TYPE_ATTR(unchecked) // SIL-specific attributes TYPE_ATTR(sil_self) TYPE_ATTR(local_storage) TYPE_ATTR(sil_unowned) TYPE_ATTR(sil_weak) TYPE_ATTR(out) TYPE_ATTR(in) TYPE_ATTR(inout) TYPE_ATTR(owned) TYPE_ATTR(guaranteed) TYPE_ATTR(autoreleased) TYPE_ATTR(callee_owned) TYPE_ATTR(callee_guaranteed) TYPE_ATTR(objc_metatype) TYPE_ATTR(opened) // Schema for DECL_ATTR: // // - Attribute name. // - Options for the attribute, including the declarations the // attribute can appear, and whether duplicates are allowed. DECL_ATTR(asmname, OnFunc|OnConstructor|OnDestructor) DECL_ATTR(availability, OnFunc | OnStruct | OnEnum | OnClass | OnProtocol | OnVar | OnConstructor | OnDestructor | AllowMultipleAttributes) DECL_ATTR(objc, OnFunc |OnClass | OnProtocol | OnVar | OnSubscript | OnConstructor | OnDestructor) ATTR(assignment) ATTR(class_protocol) ATTR(conversion) ATTR(exported) ATTR(infix) ATTR(mutating) ATTR(noreturn) ATTR(prefix) ATTR(postfix) ATTR(optional) ATTR(override) ATTR(required) ATTR(transparent) ATTR(unowned) ATTR(weak) ATTR(requires_stored_property_inits) IB_ATTR(IBOutlet) IB_ATTR(IBAction) IB_ATTR(IBDesignable) IB_ATTR(IBInspectable) // "Virtual" attributes can not be spelled in the source code. VIRTUAL_ATTR(raw_doc_comment) #undef VIRTUAL_ATTR #undef IB_ATTR #undef DECL_ATTR #undef TYPE_ATTR #undef ATTR