// // ...apply reduce...
// }
llvm::ArrayRef<RuleID> getReduceRules(StateID State) const {
- if (ReduceOffset[State] >= Reduces.size())
- return {};
- size_t Length = ReduceOffset[State + 1] - ReduceOffset[State];
- return llvm::makeArrayRef(&Reduces[ReduceOffset[State]],
- Length);
+ assert(State + 1u < ReduceOffset.size());
+ return llvm::makeArrayRef(Reduces.data() + ReduceOffset[State],
+ Reduces.data() + ReduceOffset[State+1]);
}
// Returns whether Terminal can follow Nonterminal in a valid source file.
bool canFollow(SymbolID Nonterminal, SymbolID Terminal) const {