HazardyKnusperkeks marked 2 inline comments as done. HazardyKnusperkeks added inline comments.
================ Comment at: clang/lib/Format/WhitespaceManager.cpp:332-340 if (Changes[ScopeStart - 1].Tok->is(TT_FunctionDeclarationName) || (ScopeStart > Start + 1 && Changes[ScopeStart - 2].Tok->is(TT_FunctionDeclarationName)) || + (ScopeStart > Start + 1 && + Changes[ScopeStart - 2].Tok->is(tok::identifier) && + Changes[ScopeStart - 1].Tok->is(tok::l_paren)) || Changes[i].Tok->is(TT_ConditionalExpr) || ---------------- curdeius wrote: > Would it be possible to break up this condition and name it (or name its > parts)? It's getting hard to follow. > Suggestion according to my understanding, which might be wrong. Can do, but then all those are always checked, there is no short circuit anymore. But I really get your point. How about a lambda with different returns (and comments), that way we would still short circuit. Or some thing like ``` bool AddShift = /* checks #1 */; AddShift = AddShift || /* checks #2 */; ... AddShift = AddShoft || /* checks #n */; if (AddShift) Changes[i].Spaces += Shift; ``` ================ Comment at: clang/unittests/Format/FormatTest.cpp:14305-14311 + verifyFormat("void foo() {\n" + " int myVar = 5;\n" + " double x = 3.14;\n" + " auto str = \"Hello \"\n" + " \"World\";\n" + "}", + Style); ---------------- curdeius wrote: > Nice tests. I'd like to see however the behaviour when there's another > assignment/declaration after a multi-line string, maybe even mixing > multi-line strings and multi-line function calls. You already do test > multiple multi-line function calls (with `newEntry` and `newEntry2`). Mixing can be done, but I really failed to come up with a function call scenario in the short version. That's why I took my (slightly modified) real life example where I hit that bug. Also: Nice comment, I found another bug. It seems that the alignment stops after the broken string literal, I have no fix yet, but an idea. Will reupload when done. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D98214/new/ https://reviews.llvm.org/D98214 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits