================
@@ -90,6 +90,12 @@ static bool isCppAttribute(bool IsCpp, const FormatToken 
&Tok) {
   // The first square bracket is part of an ObjC array literal
   if (Tok.Previous && Tok.Previous->is(tok::at))
     return false;
+  // A C++ attribute specifier '[[...]]' never appears directly inside another
+  // '['. Treating malformed input like '[[[a]]' as one would mis-annotate the
+  // inner '[' as TT_AttributeLSquare while leaving the outer '[' as a raw
+  // tok::l_square, tripping an assertion in canBreakBefore.
+  if (Tok.Previous && Tok.Previous->is(tok::l_square))
----------------
mygitljf wrote:

I don’t think this helps — I’ve verified it.
For `[[[a]]`, the error hits the middle `[` — the loop only runs over `a ] ]` 
and never finds the `[`, so the `is(tok::l_square)` check in the loop never 
triggers.

https://github.com/llvm/llvm-project/pull/199103
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to