[clang] [clang-format] Fix a bug in annotating angles containing FatArrow (PR #108671)
Emilia Kond via cfe-commits
cfe-commits at lists.llvm.org
Mon Sep 30 00:36:12 PDT 2024
================
@@ -243,14 +244,16 @@ class AnnotatingParser {
// operator that was misinterpreted because we are parsing template
// parameters.
// FIXME: This is getting out of hand, write a decent parser.
- if (InExpr && !Line.startsWith(tok::kw_template) &&
+ if (InExpr && !SeenFatArrow && !Line.startsWith(tok::kw_template) &&
Prev.is(TT_BinaryOperator)) {
const auto Precedence = Prev.getPrecedence();
if (Precedence > prec::Conditional && Precedence < prec::Relational)
return false;
}
if (Prev.isOneOf(tok::question, tok::colon) && !Style.isProto())
SeenTernaryOperator = true;
+ else if (Prev.is(TT_FatArrow))
----------------
rymiel wrote:
> If they were to just change handling of ternary expressions, but they changed behavior for expressions that don't have ? in them, it sounds like an unintended change.
All these template edge-cases weren't being represented in testing. My change broke no tests, but it caused a lot of fallout in the issues. I regret making that change, but by now it's too late. I'm sorry
https://github.com/llvm/llvm-project/pull/108671
More information about the cfe-commits
mailing list