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

Björn Schäpers via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat Feb 12 01:02:17 PST 2022

HazardyKnusperkeks planned changes to this revision.
HazardyKnusperkeks added inline comments.

Comment at: clang/lib/Format/ContinuationIndenter.cpp:1356
+  // Do not use CurrentState here, since the two functions before may change the
+  // Stack.
curdeius wrote:
> Maybe it would be better to use a pointer instead of a reference and then you could rebind it to the need `back()`?
I'm not a fan of using pointers for such things. I would've done that, if the remaining function was longer or we had more calls to the state.

Comment at: clang/lib/Format/ContinuationIndenter.cpp:1514
+  auto &CurrentState = State.Stack.back();
owenpan wrote:
> Can you make it `const` here?
I think yeah I could. This is maybe an remainder of some of my tries to get the requires stuff working, that I would've changed the current state here.

  rG LLVM Github Monorepo



More information about the cfe-commits mailing list