[clang] 23b7836 - [clang-format] update documentation

via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 24 13:10:45 PDT 2019


Author: paulhoad
Date: 2019-10-24T21:10:13+01:00
New Revision: 23b78364150cd946a8b111e87defdf179eecbc8f

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

LOG: [clang-format] update documentation

Summary:
  - Added example code for BreakStringLiterals;

Reviewers: MyDeveloperDay

Reviewed By: MyDeveloperDay

Patch By: mrexodia

Subscribers: cfe-commits, MyDeveloperDay

Tags: #clang-tools-extra, #clang-format, #clang

Differential Revision: https://reviews.llvm.org/D31574

Added: 
    

Modified: 
    clang/docs/ClangFormatStyleOptions.rst
    clang/include/clang/Format/Format.h

Removed: 
    


################################################################################
diff  --git a/clang/docs/ClangFormatStyleOptions.rst b/clang/docs/ClangFormatStyleOptions.rst
index 3cd47d3c0ac0..cadb6d4f4919 100644
--- a/clang/docs/ClangFormatStyleOptions.rst
+++ b/clang/docs/ClangFormatStyleOptions.rst
@@ -1321,6 +1321,17 @@ the configuration (without a prefix: ``Auto``).
 **BreakStringLiterals** (``bool``)
   Allow breaking string literals when formatting.
 
+  .. code-block:: c++
+
+     true:
+     const char* x = "veryVeryVeryVeryVeryVe"
+                     "ryVeryVeryVeryVeryVery"
+                     "VeryLongString";
+
+     false:
+     const char* x =
+       "veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongString";
+
 **ColumnLimit** (``unsigned``)
   The column limit.
 

diff  --git a/clang/include/clang/Format/Format.h b/clang/include/clang/Format/Format.h
index 7e71b7e8b167..1095821eb664 100644
--- a/clang/include/clang/Format/Format.h
+++ b/clang/include/clang/Format/Format.h
@@ -782,7 +782,7 @@ struct FormatStyle {
   /// The brace breaking style to use.
   BraceBreakingStyle BreakBeforeBraces;
 
-  // Different ways to wrap braces after control statements.
+  /// Different ways to wrap braces after control statements.
   enum BraceWrappingAfterControlStatementStyle {
     /// Never wrap braces after a control statement.
     /// \code
@@ -1077,6 +1077,16 @@ struct FormatStyle {
   bool BreakAfterJavaFieldAnnotations;
 
   /// Allow breaking string literals when formatting.
+  /// \code
+  ///    true:
+  ///    const char* x = "veryVeryVeryVeryVeryVe"
+  ///                    "ryVeryVeryVeryVeryVery"
+  ///                    "VeryLongString";
+  ///
+  ///    false:
+  ///    const char* x =
+  ///      "veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongString";
+  /// \endcode
   bool BreakStringLiterals;
 
   /// The column limit.
@@ -1985,7 +1995,6 @@ struct FormatStyle {
     /// Latest: Parse and format using the latest supported language version.
     /// 'Cpp11' is an alias for LS_Latest for historical reasons.
     LS_Latest,
-
     /// Auto: Automatic detection based on the input.
     /// Parse using the latest language version. Format based on detected input.
     LS_Auto,


        


More information about the cfe-commits mailing list