[clang] [clang-format] Fix a bug in annotating angles containing FatArrow (PR #108671)

via cfe-commits cfe-commits at lists.llvm.org
Fri Oct 4 03:08:23 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))
----------------
mydeveloperday wrote:

If you are interested in the "Cheap Shot" ... https://www.youtube.com/watch?v=NnQraMtpvws This is from a JetBrains employee which frankly I'd have expected better from given the feedback I gave them on their blog  https://blog.jetbrains.com/clion/2023/12/a-clangformat-story-and-the-third-clion-nova-update/ 

https://github.com/llvm/llvm-project/pull/108671


More information about the cfe-commits mailing list