MCPcopy Create free account
hub / github.com/NVIDIA/cuda-tile / next

Method next

lib/Bytecode/Reader/BytecodeReader.cpp:796–821  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

794 /// Return the next debug info attribute for the current operation.
795 template <typename T>
796 T next() {
797 // Check if the index is reserved for special debug info attributes.
798 if (opIndex == static_cast<uint64_t>(Bytecode::DebugReserved::UnknownLoc))
799 return dyn_cast<T>(UnknownLoc::get(&reader.context));
800
801 // Adjust the index to account for reserved indices.
802 auto actualOpIndex =
803 opIndex - static_cast<uint64_t>(Bytecode::DebugReserved::SIZE);
804
805 // Calculate the offset for the current operation index.
806 if (actualOpIndex >= reader.diIndexOffsets.size())
807 return T();
808 auto offset = reader.diIndexOffsets[actualOpIndex];
809
810 // Validate size to prevent excessive memory allocation.
811 if (reader.diIndices.size() > (std::numeric_limits<uint32_t>::max() - 1))
812 return T();
813 if (offset > (std::numeric_limits<uint32_t>::max() - 1))
814 return T();
815 if (offset + opIndexOffset >= reader.diIndices.size())
816 return T();
817 offset += opIndexOffset++;
818
819 // Return the next debug info attribute for the current operation.
820 return reader.getDebugInfo<T>(reader.diIndices[offset]);
821 }
822
823 private:
824 DebugInfoReader &reader;

Callers

nothing calls this directly

Calls 2

maxFunction · 0.85
sizeMethod · 0.80

Tested by

no test coverage detected