r201323 - clang-format: Improve documentation of DerivePointerBinding.

Daniel Jasper djasper at google.com
Thu Feb 13 04:51:51 PST 2014


Author: djasper
Date: Thu Feb 13 06:51:50 2014
New Revision: 201323

URL: http://llvm.org/viewvc/llvm-project?rev=201323&view=rev
Log:
clang-format: Improve documentation of DerivePointerBinding.

For reference: llvm.org/PR18690.

Also updated generated help page and page creation script.

Modified:
    cfe/trunk/docs/ClangFormatStyleOptions.rst
    cfe/trunk/docs/tools/dump_format_style.py
    cfe/trunk/include/clang/Format/Format.h

Modified: cfe/trunk/docs/ClangFormatStyleOptions.rst
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/ClangFormatStyleOptions.rst?rev=201323&r1=201322&r2=201323&view=diff
==============================================================================
--- cfe/trunk/docs/ClangFormatStyleOptions.rst (original)
+++ cfe/trunk/docs/ClangFormatStyleOptions.rst Thu Feb 13 06:51:50 2014
@@ -146,6 +146,10 @@ the configuration (without a prefix: ``A
     Like ``Attach``, but break before function definitions.
   * ``BS_Allman`` (in configuration: ``Allman``)
     Always break before braces.
+  * ``BS_GNU`` (in configuration: ``GNU``)
+    Always break before braces and add an extra level of indentation to
+    braces of control statements, not to those of class, function
+    or other definitions.
 
 
 **BreakBeforeTernaryOperators** (``bool``)
@@ -162,6 +166,10 @@ the configuration (without a prefix: ``A
   clang-format will respect the input's line breaking decisions within
   statements unless they contradict other rules.
 
+**CommentPragmas** (``std::string``)
+  A regular expression that describes comments with special meaning,
+  which should not be split into lines or otherwise changed.
+
 **ConstructorInitializerAllOnOneLineOrOnePerLine** (``bool``)
   If the constructor initializers don't fit on a line, put each
   initializer on its own line.
@@ -189,7 +197,8 @@ the configuration (without a prefix: ``A
   a zero-length name is assumed.
 
 **DerivePointerBinding** (``bool``)
-  If ``true``, analyze the formatted file for the most common binding.
+  If ``true``, analyze the formatted file for the most common binding
+  and use ``PointerBindsToType`` only as fallback.
 
 **ExperimentalAutoDetectBinPacking** (``bool``)
   If ``true``, clang-format detects whether function calls and
@@ -227,6 +236,9 @@ the configuration (without a prefix: ``A
     Should be used for C, C++, ObjectiveC, ObjectiveC++.
   * ``LK_JavaScript`` (in configuration: ``JavaScript``)
     Should be used for JavaScript.
+  * ``LK_Proto`` (in configuration: ``Proto``)
+    Should be used for Protocol Buffers
+    (https://developers.google.com/protocol-buffers/).
 
 
 **MaxEmptyLinesToKeep** (``unsigned``)
@@ -245,6 +257,10 @@ the configuration (without a prefix: ``A
     Indent in all namespaces.
 
 
+**ObjCSpaceAfterProperty** (``bool``)
+  Add a space after ``@property`` in Objective-C, i.e. use
+  ``@property (readonly)`` instead of ``@property(readonly)``.
+
 **ObjCSpaceBeforeProtocolList** (``bool``)
   Add a space in front of an Objective-C protocol list, i.e. use
   ``Foo <Protocol>`` instead of ``Foo<Protocol>``.
@@ -292,7 +308,7 @@ the configuration (without a prefix: ``A
 
 
 **SpaceInEmptyParentheses** (``bool``)
-  If ``false``, spaces may be inserted into '()'.
+  If ``true``, spaces may be inserted into '()'.
 
 **SpacesBeforeTrailingComments** (``unsigned``)
   The number of spaces to before trailing line comments.
@@ -302,7 +318,11 @@ the configuration (without a prefix: ``A
   template argument lists
 
 **SpacesInCStyleCastParentheses** (``bool``)
-  If ``false``, spaces may be inserted into C style casts.
+  If ``true``, spaces may be inserted into C style casts.
+
+**SpacesInContainerLiterals** (``bool``)
+  If ``true``, spaces are inserted inside container literals (e.g.
+  ObjC and Javascript array and dict literals).
 
 **SpacesInParentheses** (``bool``)
   If ``true``, spaces will be inserted after '(' and before ')'.

Modified: cfe/trunk/docs/tools/dump_format_style.py
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/tools/dump_format_style.py?rev=201323&r1=201322&r2=201323&view=diff
==============================================================================
--- cfe/trunk/docs/tools/dump_format_style.py (original)
+++ cfe/trunk/docs/tools/dump_format_style.py Thu Feb 13 06:51:50 2014
@@ -98,7 +98,7 @@ def read_options(header):
         enum = Enum(name, comment)
       elif line.endswith(';'):
         state = State.InStruct
-        field_type, field_name = re.match(r'(\w+)\s+(\w+);', line).groups()
+        field_type, field_name = re.match(r'([:\w]+)\s+(\w+);', line).groups()
         option = Option(str(field_name), str(field_type), comment)
         options.append(option)
       else:
@@ -122,7 +122,7 @@ def read_options(header):
     raise Exception('Not finished by the end of file')
 
   for option in options:
-    if not option.type in ['bool', 'unsigned', 'int']:
+    if not option.type in ['bool', 'unsigned', 'int', 'std::string']:
       if enums.has_key(option.type):
         option.enum = enums[option.type]
       else:

Modified: cfe/trunk/include/clang/Format/Format.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Format/Format.h?rev=201323&r1=201322&r2=201323&view=diff
==============================================================================
--- cfe/trunk/include/clang/Format/Format.h (original)
+++ cfe/trunk/include/clang/Format/Format.h Thu Feb 13 06:51:50 2014
@@ -76,7 +76,8 @@ struct FormatStyle {
   /// \brief Set whether & and * bind to the type as opposed to the variable.
   bool PointerBindsToType;
 
-  /// \brief If \c true, analyze the formatted file for the most common binding.
+  /// \brief If \c true, analyze the formatted file for the most common binding
+  /// and use \c PointerBindsToType only as fallback.
   bool DerivePointerBinding;
 
   /// \brief The extra indent or outdent of access modifiers, e.g. \c public:.





More information about the cfe-commits mailing list