1// RUN: %check_clang_tidy %s google-readability-namespace-comments %t -std=c++20 \
2// RUN: '-config={CheckOptions: { \
3// RUN: google-readability-namespace-comments.AllowOmittingNamespaceComments: true, \
4// RUN: google-readability-namespace-comments.ShortNamespaceLines: 0, \
5// RUN: }}'
6
7// accept if namespace comments are fully omitted
8namespace n1::n2 {
9namespace /*comment1*/n3/*comment2*/::/*comment3*/inline/*comment4*/n4/*comment5*/ {
10void f();
11}}
12
13namespace n5::inline n6 {
14void f();
15}
16
17namespace n7::inline n8 {
18void f();
19}
20
21// accept if namespace comments are partly omitted (e.g. only for nested namespace)
22namespace n1::n2 {
23namespace n3::n4 {
24void f();
25}
26} // namespace n1::n2
27
28// fail if namespace comment is different than expected
29namespace n9::inline n10 {
30void f();
31} // namespace n9::n10
32// CHECK-MESSAGES: :[[@LINE-1]]:2: warning: namespace 'n9::inline n10' ends with a comment that refers to a wrong namespace 'n9::n10' [google-readability-namespace-comments]
33

Provided by KDAB

Privacy Policy
Update your C++ knowledge – Modern C++11/14/17 Training
Find out more

source code of clang-tools-extra/test/clang-tidy/checkers/google/readability-namespace-comments-missing-nested-namespaces.cpp