- if (read_vbr(Buf, EndBuf, Result.Opcode)) return true;
- Result.Opcode >>= 2;
- if (read_vbr(Buf, EndBuf, Typ)) return true;
- Result.Ty = getType(Typ);
- if (Result.Ty == 0) return true;
- if (read_vbr(Buf, EndBuf, Result.NumOperands)) return true;
-
- switch (Result.NumOperands) {
+ if (read_vbr(Buf, EndBuf, Result->Opcode))
+ throw std::string("Error reading from buffer.");
+ Result->Opcode >>= 2;
+ if (read_vbr(Buf, EndBuf, Typ))
+ throw std::string("Error reading from buffer.");
+ Result->Ty = getType(Typ);
+ if (Result->Ty == 0)
+ throw std::string("Invalid type read in instruction.");
+ if (read_vbr(Buf, EndBuf, Result->NumOperands))
+ throw std::string("Error reading from buffer.");
+
+ switch (Result->NumOperands) {