[PATCH] D127578: [clang-format] Handle deprecated options in dump_format_style.py

Owen Pan via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat Jun 11 13:16:13 PDT 2022


owenpan created this revision.
owenpan added reviewers: MyDeveloperDay, curdeius, HazardyKnusperkeks.
owenpan added a project: clang-format.
Herald added a project: All.
owenpan requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Also add two deprecated options as comments back to Format.h.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D127578

Files:
  clang/docs/tools/dump_format_style.py
  clang/include/clang/Format/Format.h


Index: clang/include/clang/Format/Format.h
===================================================================
--- clang/include/clang/Format/Format.h
+++ clang/include/clang/Format/Format.h
@@ -395,6 +395,11 @@
   /// \version 9
   bool AllowAllArgumentsOnNextLine;
 
+  /// This option is **deprecated**. See ``NextLine`` of
+  /// ``PackConstructorInitializers``.
+  /// \version 9
+  // bool AllowAllConstructorInitializersOnNextLine;
+
   /// If the function declaration doesn't fit on a line,
   /// allow putting all parameters of a function declaration onto
   /// the next line even if ``BinPackParameters`` is ``false``.
@@ -1878,6 +1883,11 @@
   /// \version 5
   bool CompactNamespaces;
 
+  /// This option is **deprecated**. See ``CurrentLine`` of
+  /// ``PackConstructorInitializers``.
+  /// \version 3.7
+  // bool ConstructorInitializerAllOnOneLineOrOnePerLine;
+
   /// The number of characters to use for indentation of constructor
   /// initializer lists as well as inheritance lists.
   /// \version 3.7
Index: clang/docs/tools/dump_format_style.py
===================================================================
--- clang/docs/tools/dump_format_style.py
+++ clang/docs/tools/dump_format_style.py
@@ -267,6 +267,9 @@
           name = re.sub(r'struct\s+(\w+)\s*\{', '\\1', line)
           nested_struct = NestedStruct(name, comment)
         elif line.endswith(';'):
+          prefix = '// '
+          if line.startswith(prefix):
+            line = line[len(prefix):]
           state = State.InStruct
           field_type, field_name = re.match(r'([<>:\w(,\s)]+)\s+(\w+);',
                                             line).groups()


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D127578.436165.patch
Type: text/x-patch
Size: 1668 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220611/8c48964f/attachment-0001.bin>


More information about the cfe-commits mailing list