1// RUN: %check_clang_tidy %s readability-static-accessed-through-instance %t -- -config="{CheckOptions: {readability-static-accessed-through-instance.NameSpecifierNestingThreshold: 4}}" --
2
3// Nested specifiers
4namespace M {
5namespace N {
6struct V {
7 static int v;
8 struct T {
9 static int t;
10 struct U {
11 static int u;
12 };
13 };
14};
15}
16}
17
18void f(M::N::V::T::U u) {
19 M::N::V v;
20 v.v = 12;
21 // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: static member
22 // CHECK-FIXES: {{^}} M::N::V::v = 12;{{$}}
23
24 M::N::V::T w;
25 w.t = 12;
26 // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: static member
27 // CHECK-FIXES: {{^}} M::N::V::T::t = 12;{{$}}
28
29 // u.u is not changed, because the nesting level is over 4
30 u.u = 12;
31 // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: static member
32 // CHECK-FIXES: {{^}} u.u = 12;{{$}}
33}
34

source code of clang-tools-extra/test/clang-tidy/checkers/readability/static-accessed-through-instance-nesting-threshold.cpp