[clang-format][NFC] Improve documentation of FixNamespaceComments

Fixes https://github.com/llvm/llvm-project/issues/55162
This commit is contained in:
Björn Schäpers 2022-11-12 05:51:19 +01:00
parent 40c1476e3a
commit cb01befda5
2 changed files with 16 additions and 10 deletions

View File

@ -2696,16 +2696,19 @@ the configuration (without a prefix: ``Auto``).
**FixNamespaceComments** (``Boolean``) :versionbadge:`clang-format 5` **FixNamespaceComments** (``Boolean``) :versionbadge:`clang-format 5`
If ``true``, clang-format adds missing namespace end comments for If ``true``, clang-format adds missing namespace end comments for
short namespaces and fixes invalid existing ones. Short ones are namespaces and fixes invalid existing ones. This doesn't affect short
controlled by "ShortNamespaceLines". namespaces, which are controlled by ``ShortNamespaceLines``.
.. code-block:: c++ .. code-block:: c++
true: false: true: false:
namespace a { vs. namespace a { namespace longNamespace { vs. namespace longNamespace {
foo(); foo(); void foo(); void foo();
bar(); bar(); void bar(); void bar();
} // namespace a } } // namespace a }
namespace shortNamespace { namespace shortNamespace {
void baz(); void baz();
} }
**ForEachMacros** (``List of Strings``) :versionbadge:`clang-format 3.7` **ForEachMacros** (``List of Strings``) :versionbadge:`clang-format 3.7`
A vector of macros that should be interpreted as foreach loops A vector of macros that should be interpreted as foreach loops

View File

@ -2121,14 +2121,17 @@ struct FormatStyle {
bool ExperimentalAutoDetectBinPacking; bool ExperimentalAutoDetectBinPacking;
/// If ``true``, clang-format adds missing namespace end comments for /// If ``true``, clang-format adds missing namespace end comments for
/// short namespaces and fixes invalid existing ones. Short ones are /// namespaces and fixes invalid existing ones. This doesn't affect short
/// controlled by "ShortNamespaceLines". /// namespaces, which are controlled by ``ShortNamespaceLines``.
/// \code /// \code
/// true: false: /// true: false:
/// namespace a { vs. namespace a { /// namespace longNamespace { vs. namespace longNamespace {
/// foo(); foo(); /// void foo(); void foo();
/// bar(); bar(); /// void bar(); void bar();
/// } // namespace a } /// } // namespace a }
/// namespace shortNamespace { namespace shortNamespace {
/// void baz(); void baz();
/// } }
/// \endcode /// \endcode
/// \version 5 /// \version 5
bool FixNamespaceComments; bool FixNamespaceComments;