r219204 - clang-format: Add documentation about disabling formatting.

Daniel Jasper djasper at google.com
Tue Oct 7 05:15:15 PDT 2014


Author: djasper
Date: Tue Oct  7 07:15:15 2014
New Revision: 219204

URL: http://llvm.org/viewvc/llvm-project?rev=219204&view=rev
Log:
clang-format: Add documentation about disabling formatting.

Patch by Marek Kurdej, thanks!

Modified:
    cfe/trunk/docs/ClangFormatStyleOptions.rst

Modified: cfe/trunk/docs/ClangFormatStyleOptions.rst
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/ClangFormatStyleOptions.rst?rev=219204&r1=219203&r2=219204&view=diff
==============================================================================
--- cfe/trunk/docs/ClangFormatStyleOptions.rst (original)
+++ cfe/trunk/docs/ClangFormatStyleOptions.rst Tue Oct  7 07:15:15 2014
@@ -85,6 +85,24 @@ is applied for all input files. The form
   -style='{key1: value1, key2: value2, ...}'
 
 
+Disabling Formatting on a Piece of Code
+=======================================
+
+Clang-format understands also special comments that switch formatting in a
+delimited range. The code between a comment ``// clang-format off`` or
+``/* clang-format off */`` up to a comment ``// clang-format on`` or
+``/* clang-format on */`` will not be formatted. The comments themselves
+will be formatted (aligned) normally.
+
+.. code-block:: c++
+
+  int formatted_code;
+  // clang-format off
+      void    unformatted_code  ;
+  // clang-format on
+  void formatted_code_again;
+
+
 Configuring Style in Code
 =========================
 





More information about the cfe-commits mailing list