================
@@ -33,6 +33,244 @@ class Context;
class Pointer;
inline llvm::raw_ostream &operator<<(llvm::raw_ostream &OS, const Pointer &P);
+struct PtrView {
+ Block *Pointee; // XXX const?
+ unsigned Base;
+ uint64_t Offset;
+
+ bool isRoot() const {
+ return Base == Pointee->getDescriptor()->getMetadataSize();
+ }
+
+ InlineDescriptor *getInlineDesc() const {
+ assert(Base != sizeof(GlobalInlineDescriptor));
+ assert(Base <= Pointee->getSize());
+ assert(Base >= sizeof(InlineDescriptor));
+ return getDescriptor(Base);
+ }
+
+ InlineDescriptor *getDescriptor(unsigned Offset) const {
+ assert(Offset != 0 && "Not a nested pointer");
+ return reinterpret_cast<InlineDescriptor *>(Pointee->rawData() + Offset) -
+ 1;
+ }
----------------
tbaederr wrote:
Well we have to encode the knowledge somewhere and `Block`s are currently just
a dumb data storage, the knowledge is encoded in `Pointer` (and now in
`PtrView`).
https://github.com/llvm/llvm-project/pull/184129
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits