[PATCH] D115050: [clang-format] PR48916 PointerAlignment not working when using C++20 init-statement in for loop
Björn Schäpers via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Dec 3 10:28:45 PST 2021
HazardyKnusperkeks added inline comments.
================
Comment at: clang/lib/Format/TokenAnnotator.cpp:3052
+ // & 1
+ if (Right.Tok.isLiteral())
+ return true;
----------------
Is this valid code? Or did we just wrongly assign PointerOrReference? I'd say after that there can not be a literal in valid code, thus we do not need to handle it.
================
Comment at: clang/lib/Format/TokenAnnotator.cpp:3065
+ // for (auto a = 0, b = 0; const auto& c : {1, 2, 3})
+ if (Left.Previous && Left.Previous->is(tok::kw_auto) &&
+ Right.is(tok::identifier))
----------------
Do we need this just for `auto`? What when `auto` is replaced with `int`?
================
Comment at: clang/lib/Format/TokenAnnotator.cpp:3070
+
+ return (
+ !Right.isOneOf(TT_PointerOrReference, TT_ArraySubscriptLSquare,
----------------
Drop the outer paren?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D115050/new/
https://reviews.llvm.org/D115050
More information about the cfe-commits
mailing list