[clang] [clang-format] Add new option: WrapNamespaceBodyWithNewlines (PR #106145)

Björn Schäpers via cfe-commits cfe-commits at lists.llvm.org
Tue Aug 27 11:06:04 PDT 2024


================
@@ -32,6 +32,24 @@ bool isRecordLBrace(const FormatToken &Tok) {
                      TT_StructLBrace, TT_UnionLBrace);
 }
 
+bool LineStartsNamespaceScope(const AnnotatedLine* Line,
+                              const AnnotatedLine* PreviousLine,
+                              const AnnotatedLine* PrevPrevLine) {
+  return PreviousLine && PreviousLine->Last->is(tok::l_brace) &&
----------------
HazardyKnusperkeks wrote:

The existence of `PrevPrevLine` suggest that `PreviousLine` has to exist. Just assert on that.

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


More information about the cfe-commits mailing list