forked from swiftlang/swift
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathWeakTypeInfo.h
59 lines (50 loc) · 2.13 KB
/
WeakTypeInfo.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
//===--- WeakTypeInfo.h - Supplemental API for [weak] types -----*- 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 WeakTypeInfo, which supplements the FixedTypeInfo
// interface for types that implement [weak] references.
//
//===----------------------------------------------------------------------===//
#ifndef SWIFT_IRGEN_WEAKTYPEINFO_H
#define SWIFT_IRGEN_WEAKTYPEINFO_H
#include "FixedTypeInfo.h"
namespace swift {
namespace irgen {
/// \brief An abstract class designed for use when implementing a
/// ReferenceStorageType with [weak] ownership.
class WeakTypeInfo : public FixedTypeInfo {
protected:
WeakTypeInfo(llvm::Type *type, Size size, Alignment align,
const SpareBitVector &spareBits)
: FixedTypeInfo(type, size, spareBits, align, IsNotPOD,
IsNotBitwiseTakable, IsFixedSize, STIK_Weak) {}
WeakTypeInfo(llvm::Type *type, Size size, Alignment align,
SpareBitVector &&spareBits)
: FixedTypeInfo(type, size, std::move(spareBits), align, IsNotPOD,
IsNotBitwiseTakable, IsFixedSize, STIK_Weak) {}
public:
virtual void weakLoadStrong(IRGenFunction &IGF, Address addr,
Explosion &out) const = 0;
virtual void weakTakeStrong(IRGenFunction &IGF, Address addr,
Explosion &out) const = 0;
virtual void weakInit(IRGenFunction &IGF, Explosion &src,
Address dest) const = 0;
virtual void weakAssign(IRGenFunction &IGF, Explosion &src,
Address dest) const = 0;
static bool classof(const WeakTypeInfo *type) { return true; }
static bool classof(const TypeInfo *type) {
return type->getSpecialTypeInfoKind() == STIK_Weak;
}
};
}
}
#endif