Debian Codegraph @

clang-tools-extra/docs/clang-tidy/checks/readability/static-accessed-through-instance.rst

raw
1 .. title:: clang-tidy - readability-static-accessed-through-instance
2
3 readability-static-accessed-through-instance
4 ============================================
5
6 Checks for member expressions that access static members through instances, and
7 replaces them with uses of the appropriate qualified-id.
8
9 Example:
10
11 The following code:
12
13 .. code-block:: c++
14
15 struct C {
16 static void foo();
17 static int x;
18 enum { E1 };
19 enum E { E2 };
20 };
21
22 C *c1 = new C();
23 c1->foo();
24 c1->x;
25 c1->E1;
26 c1->E2;
27
28 is changed to:
29
30 .. code-block:: c++
31
32 C *c1 = new C();
33 C::foo();
34 C::x;
35 C::E1;
36 C::E2;
37
38 The `--fix` commandline option provides default support for safe fixes, whereas
39 `--fix-notes` enables fixes that may replace expressions with side effects,
40 potentially altering the program's behavior.