================ @@ -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)) ---------------- owenca wrote:
How realistic is your C++ example? In general, I don't think we can really tell if the angle brackets are template opener/closer or comparison operators without checking more (and very specific) contexts, e.g. the `new` keyword before `Bar` and the empty parentheses after `>`. In absence of that, it seems more likely that the angles are comparison operators. See e.g. this [test case](https://github.com/llvm/llvm-project/blob/95a0b4f729310d95d89f01f4d92ab7d2bf09941c/clang/unittests/Format/TokenAnnotatorTest.cpp#L645). https://github.com/llvm/llvm-project/pull/108671 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits