41 lines · plain
1.. title:: clang-tidy - readability-static-accessed-through-instance2 3readability-static-accessed-through-instance4============================================5 6Checks for member expressions that access static members through instances, and7replaces them with uses of the appropriate qualified-id.8 9Example:10 11The 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 28is 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 38The `--fix` commandline option provides default support for safe fixes, whereas39`--fix-notes` enables fixes that may replace expressions with side effects,40potentially altering the program's behavior.41