diff options
| author | paul_hoad <paul_hoad@amat.com> | 2019-11-08 21:12:22 +0000 |
|---|---|---|
| committer | paul_hoad <paul_hoad@amat.com> | 2019-11-08 21:14:29 +0000 |
| commit | 860ee4f3ebf56f4d2e387ceec9b8028636e72d2c (patch) | |
| tree | d2fd3f52885523c0d6caa039b7ffdf7ad6332a44 | |
| parent | fa03665e8666e72ca1c5c2f78aa86e8de64bdd1e (diff) | |
| download | bcm5719-llvm-860ee4f3ebf56f4d2e387ceec9b8028636e72d2c.tar.gz bcm5719-llvm-860ee4f3ebf56f4d2e387ceec9b8028636e72d2c.zip | |
[clang-format] NFC allow Format.h to be clang-formatted but still maintain the same doc layout in ClangFormatStyleOptions.rst
Summary:
Format.h is used to generate ClangFormatStyleOptions.rst, the layout of the comments is critical to the rst file. Accidentally clang-formatting Format.h can lead to the .rst changing.
This revision simply add // clang-format off/on statement around the areas who formatting needs to be maintained, mainly around the options that are related to what happens when the line breaks due to `ColumnLimit` (which is what is happening to the comment)
This allows Format.h to be clang-formatted without causing a change in the documentation when dump_format_style.py is rerun, which is also part of the revision.
Reviewers: mitchell-stellar, klimek, sammccall, owenpan
Reviewed By: mitchell-stellar
Subscribers: cfe-commits
Tags: #clang, #clang-format
Differential Revision: https://reviews.llvm.org/D69951
| -rw-r--r-- | clang/docs/ClangFormatStyleOptions.rst | 5 | ||||
| -rw-r--r-- | clang/include/clang/Format/Format.h | 16 |
2 files changed, 14 insertions, 7 deletions
diff --git a/clang/docs/ClangFormatStyleOptions.rst b/clang/docs/ClangFormatStyleOptions.rst index 655923db9bc..e0ad9653213 100644 --- a/clang/docs/ClangFormatStyleOptions.rst +++ b/clang/docs/ClangFormatStyleOptions.rst @@ -1584,8 +1584,9 @@ the configuration (without a prefix: ``Auto``). **IndentCaseLabels** (``bool``) Indent case labels one level from the switch statement. - When ``false``, use the same indentation level as for the switch statement. - Switch statement body is always indented one level more than case labels. + When ``false``, use the same indentation level as for the switch + statement. Switch statement body is always indented one level more than + case labels. .. code-block:: c++ diff --git a/clang/include/clang/Format/Format.h b/clang/include/clang/Format/Format.h index 70e82de2884..6c6b5920f7f 100644 --- a/clang/include/clang/Format/Format.h +++ b/clang/include/clang/Format/Format.h @@ -1161,6 +1161,7 @@ struct FormatStyle { /// \endcode bool CompactNamespaces; + // clang-format off /// If the constructor initializers don't fit on a line, put each /// initializer on its own line. /// \code @@ -1178,6 +1179,7 @@ struct FormatStyle { /// } /// \endcode bool ConstructorInitializerAllOnOneLineOrOnePerLine; + // clang-format on /// The number of characters to use for indentation of constructor /// initializer lists as well as inheritance lists. @@ -1306,8 +1308,9 @@ struct FormatStyle { /// Indent case labels one level from the switch statement. /// - /// When ``false``, use the same indentation level as for the switch statement. - /// Switch statement body is always indented one level more than case labels. + /// When ``false``, use the same indentation level as for the switch + /// statement. Switch statement body is always indented one level more than + /// case labels. /// \code /// false: true: /// switch (fool) { vs. switch (fool) { @@ -1453,6 +1456,7 @@ struct FormatStyle { /// The JavaScriptQuoteStyle to use for JavaScript strings. JavaScriptQuoteStyle JavaScriptQuotes; + // clang-format off /// Whether to wrap JavaScript import/export statements. /// \code{.js} /// true: @@ -1466,6 +1470,7 @@ struct FormatStyle { /// import {VeryLongImportsAreAnnoying, VeryLongImportsAreAnnoying, VeryLongImportsAreAnnoying,} from "some/module.js" /// \endcode bool JavaScriptWrapImports; + // clang-format on /// If true, the empty line at the start of blocks is kept. /// \code @@ -1747,6 +1752,7 @@ struct FormatStyle { /// \endcode std::vector<RawStringFormat> RawStringFormats; + // clang-format off /// If ``true``, clang-format will attempt to re-flow comments. /// \code /// false: @@ -1760,6 +1766,7 @@ struct FormatStyle { /// * information */ /// \endcode bool ReflowComments; + // clang-format on /// If ``true``, clang-format will sort ``#includes``. /// \code @@ -2294,8 +2301,7 @@ tooling::Replacements reformat(const FormatStyle &Style, StringRef Code, /// a non-recoverable syntax error. tooling::Replacements reformat(const FormatStyle &Style, StringRef Code, ArrayRef<tooling::Range> Ranges, - StringRef FileName, - bool *IncompleteFormat); + StringRef FileName, bool *IncompleteFormat); /// Clean up any erroneous/redundant code in the given \p Ranges in \p /// Code. @@ -2406,6 +2412,6 @@ inline StringRef getLanguageName(FormatStyle::LanguageKind Language) { namespace std { template <> struct is_error_code_enum<clang::format::ParseError> : std::true_type {}; -} +} // namespace std #endif // LLVM_CLANG_FORMAT_FORMAT_H |

