[clang] 302ca27 - [pseudo] fix an out-of-bound error in LRTable.

Haojian Wu via cfe-commits cfe-commits at lists.llvm.org
Wed Feb 23 12:35:14 PST 2022


Author: Haojian Wu
Date: 2022-02-23T21:34:54+01:00
New Revision: 302ca279cb83043ef7d60115eb5ba58f12064a4a

URL: https://github.com/llvm/llvm-project/commit/302ca279cb83043ef7d60115eb5ba58f12064a4a
DIFF: https://github.com/llvm/llvm-project/commit/302ca279cb83043ef7d60115eb5ba58f12064a4a.diff

LOG: [pseudo] fix an out-of-bound error in LRTable.

Fix window debug build.

Added: 
    

Modified: 
    clang/lib/Tooling/Syntax/Pseudo/LRTable.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/Tooling/Syntax/Pseudo/LRTable.cpp b/clang/lib/Tooling/Syntax/Pseudo/LRTable.cpp
index 4a817a527f2fa..23c455941ff5b 100644
--- a/clang/lib/Tooling/Syntax/Pseudo/LRTable.cpp
+++ b/clang/lib/Tooling/Syntax/Pseudo/LRTable.cpp
@@ -117,7 +117,7 @@ llvm::ArrayRef<LRTable::Action> LRTable::find(StateID Src, SymbolID ID) const {
   size_t Start = It - States.data(), End = Start;
   while (End < States.size() && States[End] == Src)
     ++End;
-  return llvm::makeArrayRef(&Actions[Start], &Actions[End]);
+  return llvm::makeArrayRef(&Actions[Start], End - Start);
 }
 
 } // namespace pseudo


        


More information about the cfe-commits mailing list