Skip to content

Commit

Permalink
clang-format: Add documentation about disabling formatting.
Browse files Browse the repository at this point in the history
Patch by Marek Kurdej, thanks!

llvm-svn: 219204
  • Loading branch information
djasper-gh committed Oct 7, 2014
1 parent 65f5ae9 commit d8b4ec0
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions clang/docs/ClangFormatStyleOptions.rst
Original file line number Diff line number Diff line change
@@ -85,6 +85,24 @@ is applied for all input files. The format of the configuration is:
-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
=========================

0 comments on commit d8b4ec0

Please sign in to comment.