xref: /llvm-project/clang-tools-extra/docs/clang-tidy/checks/llvm/namespace-comment.rst (revision 6e566bc5523f743bc34a7e26f050f1f2b4d699a8)
1*6e566bc5SRichard.. title:: clang-tidy - llvm-namespace-comment
2*6e566bc5SRichard
3*6e566bc5SRichardllvm-namespace-comment
4*6e566bc5SRichard======================
5*6e566bc5SRichard
6*6e566bc5SRichard`google-readability-namespace-comments` redirects here as an alias for this
7*6e566bc5SRichardcheck.
8*6e566bc5SRichard
9*6e566bc5SRichardChecks that long namespaces have a closing comment.
10*6e566bc5SRichard
11*6e566bc5SRichardhttps://llvm.org/docs/CodingStandards.html#namespace-indentation
12*6e566bc5SRichard
13*6e566bc5SRichardhttps://google.github.io/styleguide/cppguide.html#Namespaces
14*6e566bc5SRichard
15*6e566bc5SRichard.. code-block:: c++
16*6e566bc5SRichard
17*6e566bc5SRichard  namespace n1 {
18*6e566bc5SRichard  void f();
19*6e566bc5SRichard  }
20*6e566bc5SRichard
21*6e566bc5SRichard  // becomes
22*6e566bc5SRichard
23*6e566bc5SRichard  namespace n1 {
24*6e566bc5SRichard  void f();
25*6e566bc5SRichard  }  // namespace n1
26*6e566bc5SRichard
27*6e566bc5SRichard
28*6e566bc5SRichardOptions
29*6e566bc5SRichard-------
30*6e566bc5SRichard
31*6e566bc5SRichard.. option:: ShortNamespaceLines
32*6e566bc5SRichard
33*6e566bc5SRichard   Requires the closing brace of the namespace definition to be followed by a
34*6e566bc5SRichard   closing comment if the body of the namespace has more than
35*6e566bc5SRichard   `ShortNamespaceLines` lines of code. The value is an unsigned integer that
36*6e566bc5SRichard   defaults to `1U`.
37*6e566bc5SRichard
38*6e566bc5SRichard.. option:: SpacesBeforeComments
39*6e566bc5SRichard
40*6e566bc5SRichard   An unsigned integer specifying the number of spaces before the comment
41*6e566bc5SRichard   closing a namespace definition. Default is `1U`.
42