[clang-tools-extra] bbcd8e5 - [pseudo] NFC, polish the fix of c99827349927a44334f2b04139168efd0bc87cd3
Haojian Wu via cfe-commits
cfe-commits at lists.llvm.org
Fri Jul 1 12:25:55 PDT 2022
Author: Haojian Wu
Date: 2022-07-01T21:25:46+02:00
New Revision: bbcd8e5271f4af3adc28e458642a0dc65d253acd
URL: https://github.com/llvm/llvm-project/commit/bbcd8e5271f4af3adc28e458642a0dc65d253acd
DIFF: https://github.com/llvm/llvm-project/commit/bbcd8e5271f4af3adc28e458642a0dc65d253acd.diff
LOG: [pseudo] NFC, polish the fix of c99827349927a44334f2b04139168efd0bc87cd3
Added:
Modified:
clang-tools-extra/pseudo/include/clang-pseudo/grammar/LRTable.h
Removed:
################################################################################
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 664a1a3206fe6..d480956704960 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 @@ class LRTable {
// // ...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 {
More information about the cfe-commits
mailing list