forked from OSchip/llvm-project
[pseudo] Fix an out-of-bound issue in getReduceRules.
This commit is contained in:
parent
6e8ec13d3f
commit
c998273499
|
@ -140,8 +140,11 @@ public:
|
|||
// // ...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]],
|
||||
&Reduces[ReduceOffset[State + 1]]);
|
||||
Length);
|
||||
}
|
||||
// Returns whether Terminal can follow Nonterminal in a valid source file.
|
||||
bool canFollow(SymbolID Nonterminal, SymbolID Terminal) const {
|
||||
|
|
Loading…
Reference in New Issue