[PATCH] D119597: [clang-format][NFC] Give State.Stack.back() a meaningful name

MyDeveloperDay via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat Feb 12 01:35:11 PST 2022


MyDeveloperDay added a comment.

I like this change for clarity reasons, my only concern and it's not based on evidence is what if any of these functions get passed in State, and then they themselves alter the State.Stack?

In most cases I'd expect CurrentState to always be correct, but doesn't it only represent the state of the stack as it was at the beginning of the function

Isn't the point of State.Stack.back() to get the current state? if you do that with a variable like `CurrentState` or just have `State.getCurrentState()` I don't know but the later seems a good step because you could use that in even more places

i.e.

`unsigned NestedBlockIndent = State.Stack.back().NestedBlockIndent;`

`unsigned NestedBlockIndent = State.getCurrentState().NestedBlockIndent;`


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D119597



More information about the cfe-commits mailing list