Debian Codegraph @

llvm-project/clang-tools-extra/docs/clang-tidy/checks/modernize/use-bool-literals.rst

raw
1 .. title:: clang-tidy - modernize-use-bool-literals
2
3 modernize-use-bool-literals
4 ===========================
5
6 Finds integer literals which are cast to ``bool``.
7
8 .. code-block:: c++
9
10 bool p = 1;
11 bool f = static_cast<bool>(1);
12 std::ios_base::sync_with_stdio(0);
13 bool x = p ? 1 : 0;
14
15 // transforms to
16
17 bool p = true;
18 bool f = true;
19 std::ios_base::sync_with_stdio(false);
20 bool x = p ? true : false;
21
22 Options
23 -------
24
25 .. option:: IgnoreMacros
26
27 If set to `true`, the check will not give warnings inside macros. Default
28 is `true`.