Files
swift-mirror/include/swift/AST/Ownership.h
Jordan Rose e5fc17843e Allow overrides to leave out the ownership qualifier of the decl they override.
If they do provide it, however, it must match. So the following combinations
are valid:

  weak var -> override weak var
  weak var -> override var

but these are not:

  var -> override weak var
  weak var -> override unowned var

To be fully correct, we should be cloning the attribute down and adjusting
the type of the overriding property, but I'd rather not touch that right now.

<rdar://problem/17837100>

Swift SVN r20694
2014-07-29 21:03:51 +00:00

44 lines
1.2 KiB
C++

//===--- Ownership.h - Swift ASTs for Reference Ownership -------*- 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 common structures for working with the different
// kinds of reference ownership supported by Swift, such as 'weak' and
// 'unowned'.
//
//===----------------------------------------------------------------------===//
#ifndef SWIFT_OWNERSHIP_H
#define SWIFT_OWNERSHIP_H
namespace swift {
/// Different kinds of reference ownership supported by Swift.
// This enum is used in diagnostics. If you add a case here, the diagnostics
// must be updated as well.
enum class Ownership {
/// \brief a strong reference (the default semantics)
Strong,
/// \brief a 'weak' reference
Weak,
/// \brief an 'unowned' reference
Unowned,
/// \brief an 'unowned(unsafe)' reference
Unmanaged,
};
} // end namespace swift
#endif