[clang] cb01bef - [clang-format][NFC] Improve documentation of FixNamespaceComments
Björn Schäpers via cfe-commits
cfe-commits at lists.llvm.org
Tue Nov 15 22:02:42 PST 2022
Author: Björn Schäpers
Date: 2022-11-16T07:02:10+01:00
New Revision: cb01befda5479b0368d40582f046eec44fda3cec
URL: https://github.com/llvm/llvm-project/commit/cb01befda5479b0368d40582f046eec44fda3cec
DIFF: https://github.com/llvm/llvm-project/commit/cb01befda5479b0368d40582f046eec44fda3cec.diff
LOG: [clang-format][NFC] Improve documentation of FixNamespaceComments
Fixes https://github.com/llvm/llvm-project/issues/55162
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 4d4f08690ecbf..76ae54b6ef6da 100644
--- a/clang/docs/ClangFormatStyleOptions.rst
+++ b/clang/docs/ClangFormatStyleOptions.rst
@@ -2696,16 +2696,19 @@ the configuration (without a prefix: ``Auto``).
**FixNamespaceComments** (``Boolean``) :versionbadge:`clang-format 5`
If ``true``, clang-format adds missing namespace end comments for
- short namespaces and fixes invalid existing ones. Short ones are
- controlled by "ShortNamespaceLines".
+ namespaces and fixes invalid existing ones. This doesn't affect short
+ namespaces, which are controlled by ``ShortNamespaceLines``.
.. code-block:: c++
true: false:
- namespace a { vs. namespace a {
- foo(); foo();
- bar(); bar();
+ namespace longNamespace { vs. namespace longNamespace {
+ void foo(); void foo();
+ void bar(); void bar();
} // namespace a }
+ namespace shortNamespace { namespace shortNamespace {
+ void baz(); void baz();
+ } }
**ForEachMacros** (``List of Strings``) :versionbadge:`clang-format 3.7`
A vector of macros that should be interpreted as foreach loops
diff --git a/clang/include/clang/Format/Format.h b/clang/include/clang/Format/Format.h
index ba56ef732dab0..93b84e1bfddfb 100644
--- a/clang/include/clang/Format/Format.h
+++ b/clang/include/clang/Format/Format.h
@@ -2121,14 +2121,17 @@ struct FormatStyle {
bool ExperimentalAutoDetectBinPacking;
/// If ``true``, clang-format adds missing namespace end comments for
- /// short namespaces and fixes invalid existing ones. Short ones are
- /// controlled by "ShortNamespaceLines".
+ /// namespaces and fixes invalid existing ones. This doesn't affect short
+ /// namespaces, which are controlled by ``ShortNamespaceLines``.
/// \code
/// true: false:
- /// namespace a { vs. namespace a {
- /// foo(); foo();
- /// bar(); bar();
+ /// namespace longNamespace { vs. namespace longNamespace {
+ /// void foo(); void foo();
+ /// void bar(); void bar();
/// } // namespace a }
+ /// namespace shortNamespace { namespace shortNamespace {
+ /// void baz(); void baz();
+ /// } }
/// \endcode
/// \version 5
bool FixNamespaceComments;
More information about the cfe-commits
mailing list