1 // RUN: %check_clang_tidy %s google-readability-namespace-comments %t
2 
3 namespace n1 {
4 namespace /* a comment */ n2 /* another comment */ {
5 
6 
7 void f(); // So that the namespace isn't empty.
8 
9 
10 // CHECK-MESSAGES: :[[@LINE+4]]:1: warning: namespace 'n2' not terminated with a closing comment [google-readability-namespace-comments]
11 // CHECK-MESSAGES: :[[@LINE-7]]:27: note: namespace 'n2' starts here
12 // CHECK-MESSAGES: :[[@LINE+2]]:2: warning: namespace 'n1' not terminated with
13 // CHECK-MESSAGES: :[[@LINE-10]]:11: note: namespace 'n1' starts here
14 }}
15 // CHECK-FIXES: }  // namespace n2
16 // CHECK-FIXES: }  // namespace n1
17 
18 #define MACRO macro_expansion
19 namespace MACRO {
20 void f(); // So that the namespace isn't empty.
21 // 1
22 // 2
23 // 3
24 // 4
25 // 5
26 // 6
27 // 7
28 // CHECK-MESSAGES: :[[@LINE+2]]:1: warning: namespace 'MACRO' not terminated with
29 // CHECK-MESSAGES: :[[@LINE-10]]:11: note: namespace 'MACRO' starts here
30 }
31 // CHECK-FIXES: }  // namespace MACRO
32 
33 namespace macro_expansion {
34 void ff(); // So that the namespace isn't empty.
35 // 1
36 // 2
37 // 3
38 // 4
39 // 5
40 // 6
41 // 7
42 // CHECK-MESSAGES: :[[@LINE+2]]:1: warning: namespace 'macro_expansion' not terminated with
43 // CHECK-MESSAGES: :[[@LINE-10]]:11: note: namespace 'macro_expansion' starts here
44 }
45 // CHECK-FIXES: }  // namespace macro_expansion
46 
47 namespace [[deprecated("foo")]] namespace_with_attr {
48 inline namespace inline_namespace {
49 void g();
50 // 1
51 // 2
52 // 3
53 // 4
54 // 5
55 // 6
56 // 7
57 // CHECK-MESSAGES: :[[@LINE+2]]:1: warning: namespace 'inline_namespace' not terminated with
58 // CHECK-MESSAGES: :[[@LINE-10]]:18: note: namespace 'inline_namespace' starts here
59 }
60 // CHECK-FIXES: }  // namespace inline_namespace
61 // CHECK-MESSAGES: :[[@LINE+2]]:1: warning: namespace 'namespace_with_attr' not terminated with
62 // CHECK-MESSAGES: :[[@LINE-15]]:33: note: namespace 'namespace_with_attr' starts here
63 }
64 // CHECK-FIXES: }  // namespace namespace_with_attr
65 
66 namespace [[deprecated]] {
67 void h();
68 // 1
69 // 2
70 // 3
71 // 4
72 // 5
73 // 6
74 // 7
75 // CHECK-MESSAGES: :[[@LINE+2]]:1: warning: anonymous namespace not terminated with
76 // CHECK-MESSAGES: :[[@LINE-10]]:26: note: anonymous namespace starts here
77 }
78 // CHECK-FIXES: }  // namespace{{$}}
79 
80 namespace [[]] {
81 void hh();
82 // 1
83 // 2
84 // 3
85 // 4
86 // 5
87 // 6
88 // 7
89 // CHECK-MESSAGES: :[[@LINE+2]]:1: warning: anonymous namespace not terminated with
90 // CHECK-MESSAGES: :[[@LINE-10]]:16: note: anonymous namespace starts here
91 }
92 // CHECK-FIXES: }  // namespace{{$}}
93 
94 namespace short1 {
95 namespace short2 {
96 // Namespaces covering 10 lines or fewer are exempt from this rule.
97 
98 
99 
100 
101 
102 }
103 }
104 
105 namespace n3 {
106 
107 
108 
109 
110 
111 
112 
113 
114 
115 }; // namespace n3
116