+/// DiceRef
+inline DiceRef::DiceRef(DataRefImpl DiceP, const ObjectFile *Owner)
+ : DicePimpl(DiceP) , OwningObject(Owner) {}
+
+inline bool DiceRef::operator==(const DiceRef &Other) const {
+ return DicePimpl == Other.DicePimpl;
+}
+
+inline bool DiceRef::operator<(const DiceRef &Other) const {
+ return DicePimpl < Other.DicePimpl;
+}
+
+inline error_code DiceRef::getNext(DiceRef &Result) const {
+ DataRefImpl Rel = DicePimpl;
+ const macho::DataInCodeTableEntry *P =
+ reinterpret_cast<const macho::DataInCodeTableEntry *>(Rel.p);
+ Rel.p = reinterpret_cast<uintptr_t>(P + 1);
+ Result = DiceRef(Rel, OwningObject);
+ return object_error::success;
+}
+
+// Since a Mach-O data in code reference, a DiceRef, can only be created when
+// the OwningObject ObjectFile is a MachOObjectFile a static_cast<> is used for
+// the methods that get the values of the fields of the reference.
+
+inline error_code DiceRef::getOffset(uint32_t &Result) const {
+ const MachOObjectFile *MachOOF =
+ static_cast<const MachOObjectFile *>(OwningObject);
+ macho::DataInCodeTableEntry Dice = MachOOF->getDice(DicePimpl);
+ Result = Dice.Offset;
+ return object_error::success;
+}
+
+inline error_code DiceRef::getLength(uint16_t &Result) const {
+ const MachOObjectFile *MachOOF =
+ static_cast<const MachOObjectFile *>(OwningObject);
+ macho::DataInCodeTableEntry Dice = MachOOF->getDice(DicePimpl);
+ Result = Dice.Length;
+ return object_error::success;
+}
+
+inline error_code DiceRef::getKind(uint16_t &Result) const {
+ const MachOObjectFile *MachOOF =
+ static_cast<const MachOObjectFile *>(OwningObject);
+ macho::DataInCodeTableEntry Dice = MachOOF->getDice(DicePimpl);
+ Result = Dice.Kind;
+ return object_error::success;
+}
+
+inline DataRefImpl DiceRef::getRawDataRefImpl() const {
+ return DicePimpl;
+}
+
+inline const ObjectFile *DiceRef::getObjectFile() const {
+ return OwningObject;
+}
+