curdeius added a comment. Thanks for working on this! I'll have a closer look tomorrow or on Tuesday.
================ Comment at: clang/lib/Format/WhitespaceManager.cpp:735 + // Do not align operator= overloads. + if (C.Tok->Previous && C.Tok->Previous->is(tok::kw_operator)) { + auto *Next = C.Tok->Next; ---------------- Maybe `getPreviousNonComment`? Cf. test comment. ================ Comment at: clang/lib/Format/WhitespaceManager.cpp:736 + if (C.Tok->Previous && C.Tok->Previous->is(tok::kw_operator)) { + auto *Next = C.Tok->Next; + while (Next && Next->NewlinesBefore == 0) { ---------------- Please spell out the type instead of auto. ================ Comment at: clang/unittests/Format/FormatTest.cpp:16172 + "int &operator() = default;\n" + "int &operator=() {", + Alignment); ---------------- Are other operators impacted too by this bug? Like ==, <=, !=. ================ Comment at: clang/unittests/Format/FormatTest.cpp:16174 + Alignment); + verifyFormat("int() = default; // comment\n" + "int &operator() = default; // comment\n" ---------------- What happens if there's a block comment between `operator` and `=`? Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D117421/new/ https://reviews.llvm.org/D117421 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits