[clang] [clang-format] Add new option: WrapNamespaceBodyWithNewlines (PR #106145)
via cfe-commits
cfe-commits at lists.llvm.org
Tue Sep 3 04:41:38 PDT 2024
================
@@ -32,6 +32,26 @@ 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) &&
+ PreviousLine->startsWithNamespace()) ||
+ (PrevPrevLine && PrevPrevLine->startsWithNamespace() &&
+ PreviousLine->startsWith(tok::l_brace)));
+}
+
+bool LineEndsNamespaceScope(const AnnotatedLine *Line,
+ const SmallVectorImpl<AnnotatedLine *> &Lines) {
+ if (!Line)
+ return false;
+ const FormatToken *tok = Line->First;
----------------
mydeveloperday wrote:
Should be Tok
https://github.com/llvm/llvm-project/pull/106145
More information about the cfe-commits
mailing list