sammccall added inline comments.

================
Comment at: clang/lib/Tooling/Syntax/Pseudo/LRTable.cpp:115
       TargetedStates, [&Src](LRTable::StateID S) { return S < Src; });
-  if (It == TargetedStates.end())
+  if (Start == TargetedStates.end())
     return {};
----------------
hokein wrote:
> sammccall wrote:
> > I think this check is no longer needed
> sorry, should have thought more carefully on this comment, we need this check 
> to make sure we don't access `Actions[Actions.end()]` on Line120 below.
Sorry about that.

You're right, we formally do &*Actions[Actions.size()], which is invalid.

However we don't actually need a runtime check, just a change of syntax to 
avoid the dereference:

`return llvm::makeArrayRef(Actions.data() + (Start - States.data()), End - 
Start);`


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D120723/new/

https://reviews.llvm.org/D120723

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to