forked from swiftlang/swift
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathUnownedTypeInfo.h
52 lines (43 loc) · 1.71 KB
/
UnownedTypeInfo.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
//===--- UnownedTypeInfo.h - Supplemental API for [unowned] -----*- 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 UnownedTypeInfo, which supplements the FixedTypeInfo
// interface for types that implement [unowned] references.
//
//===----------------------------------------------------------------------===//
#ifndef SWIFT_IRGEN_UNOWNEDTYPEINFO_H
#define SWIFT_IRGEN_UNOWNEDTYPEINFO_H
#include "LoadableTypeInfo.h"
namespace swift {
namespace irgen {
/// \brief An abstract class designed for use when implementing a
/// ReferenceStorageType with [unowned] ownership.
class UnownedTypeInfo : public LoadableTypeInfo {
protected:
UnownedTypeInfo(llvm::Type *type, Size size,
const SpareBitVector &spareBits, Alignment align)
: LoadableTypeInfo(type, size, spareBits, align,
IsNotPOD, IsFixedSize, STIK_Unowned) {}
UnownedTypeInfo(llvm::Type *type, Size size,
SpareBitVector &&spareBits, Alignment align)
: LoadableTypeInfo(type, size, std::move(spareBits), align,
IsNotPOD, IsFixedSize, STIK_Unowned) {}
public:
// No API yet.
static bool classof(const UnownedTypeInfo *type) { return true; }
static bool classof(const TypeInfo *type) {
return type->getSpecialTypeInfoKind() == STIK_Unowned;
}
};
}
}
#endif