Lines Matching full:pointer
1 //===--- Pointer.h - Types for the constexpr VM -----------------*- C++ -*-===//
9 // Defines the classes responsible for pointer tracking.
31 class Pointer; variable
35 /// A pointer to a memory block, live or dead.
39 class Pointer {
45 Pointer() {} in Pointer() function
46 Pointer(Block *B);
47 Pointer(const Pointer &P);
48 Pointer(Pointer &&P);
49 ~Pointer();
51 void operator=(const Pointer &P);
52 void operator=(Pointer &&P);
54 /// Converts the pointer to an APValue.
57 /// Offsets a pointer inside an array.
58 Pointer atIndex(unsigned Idx) const { in atIndex()
60 return Pointer(Pointee, RootPtrMark, getDeclDesc()->getSize()); in atIndex()
66 return Pointer(Pointee, Base, Base + Off); in atIndex()
69 /// Creates a pointer to a field.
70 Pointer atField(unsigned Off) const { in atField()
72 return Pointer(Pointee, Field, Field); in atField()
75 /// Restricts the scope of an array element pointer.
76 Pointer narrow() const { in narrow()
81 // Pointer to an array of base types - enter block. in narrow()
83 return Pointer(Pointee, 0, Offset == 0 ? Offset : PastEndMark); in narrow()
85 // Pointer is one past end - magic offset marks that. in narrow()
87 return Pointer(Pointee, Base, PastEndMark); in narrow()
90 // descriptors. If Offset != Base, then the pointer already points to in narrow()
91 // an element and there is nothing to do. Otherwise, the pointer is in narrow()
96 return Pointer(Pointee, Base, Offset + sizeof(InitMap *)); in narrow()
99 // Pointer is to a field or array element - enter it. in narrow()
101 return Pointer(Pointee, Offset, Offset); in narrow()
108 return Pointer(Pointee, NewBase, NewBase); in narrow()
111 /// Expands a pointer to the containing array, undoing narrowing.
112 Pointer expand() const { in expand()
114 // Revert to an outer one-past-end pointer. in expand()
120 return Pointer(Pointee, Base, Base + getSize() + Adjust); in expand()
129 return Pointer(Pointee, RootPtrMark, 0); in expand()
136 return Pointer(Pointee, Next, Offset); in expand()
139 /// Checks if the pointer is null.
141 /// Checks if the pointer is live.
150 /// Returns a pointer to the object of which this pointer is a field.
151 Pointer getBase() const { in getBase()
154 return Pointer(Pointee, Base, 0); in getBase()
158 return Pointer(Pointee, NewBase, NewBase); in getBase()
161 Pointer getArray() const { in getArray()
164 return Pointer(Pointee, Base, 0); in getArray()
167 return Pointer(Pointee, Base, Base); in getArray()
213 /// Checks if the pointer points to an array.
215 /// Pointer points directly to a block.
276 /// Checks if the pointer is an out-of-bounds element pointer.
279 /// Dereferences the pointer, if it's live.
281 assert(isLive() && "Invalid pointer"); in deref()
298 static bool hasSameBase(const Pointer &A, const Pointer &B);
300 static bool hasSameArray(const Pointer &A, const Pointer &B);
302 /// Prints the pointer.
316 Pointer(Block *Pointee, unsigned Base, unsigned Offset);
323 assert(Offset != 0 && "Not a nested pointer"); in getDescriptor()
327 /// Returns a reference to the pointer which stores the initialization map.
332 /// The block the pointer is pointing to.
339 /// Previous link in the pointer chain.
340 Pointer *Prev = nullptr;
341 /// Next link in the pointer chain.
342 Pointer *Next = nullptr;
345 inline llvm::raw_ostream &operator<<(llvm::raw_ostream &OS, const Pointer &P) {