MyDeveloperDay added inline comments.
================ Comment at: clang/lib/Format/TokenAnnotator.cpp:1729 } else if (Current.is(tok::r_paren)) { if (rParenEndsCast(Current)) Current.setType(TT_CastRParen); ---------------- curdeius wrote: > The current solution looks a bit like a hack to me. > Unless I'm mistaken, casts can appear only in expressions, but not in > declarations (except for inside `decltype` stuff in templates or concepts, > but these are still expressions at this level). > Given that `void operator delete...` is not an expression but a declaration, > we shouldn't check `rParenEndsCast` in this case at all, no? > So, would it be possible to check here for e.g. `Line.MightBeFunctionDecl` or > something like this to avoid it? > > Also, how is it that you don't need to special-case `new` operator? I will check to see if we can use that.. To answer your second question, the existing code was this... `!isOneOf(Keywords.kw_in, tok::kw_return, tok::kw_case,tok::kw_delete)` its the `kw_delete` here that breaks the previous code. to cover this being a cast `delete (A *)a;` my change is to use more context by avoid `operator delete (A* a) a;` from being seen as a cast Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D116920/new/ https://reviews.llvm.org/D116920 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits