owenpan added a comment.

In D116318#3212351 <https://reviews.llvm.org/D116318#3212351>, @curdeius wrote:

> I'm in the same position as @hazardyknusperkeks.
> If you need something to simplify the code you can add a helper 
> `getPreviousTokenOrNull` or something like that in your patch.
> But we certainly don't want to pay for the `if` check each time we call 
> `getPreviousToken`.

I think we are going overboard here. Based on the comments, the intent was to 
return null for the previous token of the first token. I was the first and only 
one who needed to call it, and if the caller must check if it's the first token 
every time anyway, why not just do it in the callee and make the function more 
robust. Perhaps we can rename the current one to something like 
`getPreviousTokenFast`?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D116318

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

Reply via email to