| 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 |
| 4 |
namespace M { |
| 5 |
namespace N { |
| 6 |
struct 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 |
|
| 18 |
void 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 |
} |