From: Haojian Wu Date: Fri, 1 Jul 2022 19:23:29 +0000 (+0200) Subject: [pseudo] NFC, polish the fix of c99827349927a44334f2b04139168efd0bc87cd3 X-Git-Tag: upstream/15.0.7~2837 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=bbcd8e5271f4af3adc28e458642a0dc65d253acd;p=platform%2Fupstream%2Fllvm.git [pseudo] NFC, polish the fix of c99827349927a44334f2b04139168efd0bc87cd3 --- diff --git a/clang-tools-extra/pseudo/include/clang-pseudo/grammar/LRTable.h b/clang-tools-extra/pseudo/include/clang-pseudo/grammar/LRTable.h index 664a1a3..d480956 100644 --- a/clang-tools-extra/pseudo/include/clang-pseudo/grammar/LRTable.h +++ b/clang-tools-extra/pseudo/include/clang-pseudo/grammar/LRTable.h @@ -140,11 +140,9 @@ public: // // ...apply reduce... // } llvm::ArrayRef 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 {