Debian Codegraph @

clang-tools-extra/docs/clang-tidy/checks/modernize/use-using.rst

raw
1 .. title:: clang-tidy - modernize-use-using
2
3 modernize-use-using
4 ===================
5
6 The check converts the usage of ``typedef`` with ``using`` keyword.
7
8 Before:
9
10 .. code-block:: c++
11
12 typedef int variable;
13
14 class Class{};
15 typedef void (Class::* MyPtrType)() const;
16
17 typedef struct { int a; } R_t, *R_p;
18
19 After:
20
21 .. code-block:: c++
22
23 using variable = int;
24
25 class Class{};
26 using MyPtrType = void (Class::*)() const;
27
28 using R_t = struct { int a; };
29 using R_p = R_t*;
30
31 The checker ignores `typedef` within `extern "C" { ... }` blocks.
32
33 .. code-block:: c++
34
35 extern "C" {
36 typedef int InExternC; // Left intact.
37 }
38
39 This check requires using C++11 or higher to run.
40
41 Options
42 -------
43
44 .. option:: IgnoreMacros
45
46 If set to `true`, the check will not give warnings inside macros. Default
47 is `true`.
48
49 .. option:: IgnoreExternC
50
51 If set to `true`, the check will not give warning inside `extern "C"`scope.
52 Default is `false`