Lines Matching defs:Pointer
1 //===--- Pointer.h - Types for the constexpr VM -----------------*- C++ -*-===//
9 // Defines the classes responsible for pointer tracking.
31 class Pointer;
35 /// A pointer to a memory block, live or dead.
39 class Pointer {
45 Pointer() {}
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 {
60 return Pointer(Pointee, RootPtrMark, getDeclDesc()->getSize());
66 return Pointer(Pointee, Base, Base + Off);
69 /// Creates a pointer to a field.
70 Pointer atField(unsigned Off) const {
72 return Pointer(Pointee, Field, Field);
75 /// Restricts the scope of an array element pointer.
76 Pointer narrow() const {
81 // Pointer to an array of base types - enter block.
83 return Pointer(Pointee, 0, Offset == 0 ? Offset : PastEndMark);
85 // Pointer is one past end - magic offset marks that.
87 return Pointer(Pointee, Base, PastEndMark);
90 // descriptors. If Offset != Base, then the pointer already points to
91 // an element and there is nothing to do. Otherwise, the pointer is
96 return Pointer(Pointee, Base, Offset + sizeof(InitMap *));
99 // Pointer is to a field or array element - enter it.
101 return Pointer(Pointee, Offset, Offset);
108 return Pointer(Pointee, NewBase, NewBase);
111 /// Expands a pointer to the containing array, undoing narrowing.
112 Pointer expand() const {
114 // Revert to an outer one-past-end pointer.
120 return Pointer(Pointee, Base, Base + getSize() + Adjust);
129 return Pointer(Pointee, RootPtrMark, 0);
136 return Pointer(Pointee, Next, Offset);
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 {
154 return Pointer(Pointee, Base, 0);
158 return Pointer(Pointee, NewBase, NewBase);
161 Pointer getArray() const {
164 return Pointer(Pointee, Base, 0);
167 return Pointer(Pointee, Base, Base);
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");
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");
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) {