[clang] b1c300f - [clang-format] Handle deprecated options in dump_format_style.py

via cfe-commits cfe-commits at lists.llvm.org
Sun Jun 12 23:36:12 PDT 2022


Author: owenca
Date: 2022-06-12T23:35:48-07:00
New Revision: b1c300fe6849a053482d117c7d3fa425da9a7430

URL: https://github.com/llvm/llvm-project/commit/b1c300fe6849a053482d117c7d3fa425da9a7430
DIFF: https://github.com/llvm/llvm-project/commit/b1c300fe6849a053482d117c7d3fa425da9a7430.diff

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

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

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/clang/docs/tools/dump_format_style.py b/clang/docs/tools/dump_format_style.py
index fb074435e753e..e8bf29cfd2bee 100755
--- a/clang/docs/tools/dump_format_style.py
+++ b/clang/docs/tools/dump_format_style.py
@@ -267,6 +267,9 @@ class State:
           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()

diff  --git a/clang/include/clang/Format/Format.h b/clang/include/clang/Format/Format.h
index bbd96af6154a4..8249060dc7c04 100644
--- a/clang/include/clang/Format/Format.h
+++ b/clang/include/clang/Format/Format.h
@@ -395,6 +395,11 @@ struct FormatStyle {
   /// \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 @@ struct FormatStyle {
   /// \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


        


More information about the cfe-commits mailing list