@@ -9,6 +9,19 @@ The check analyses any function and variable according to the rules defined
99for the language version that the code is compiled with.
1010Changing to a newer language standard may therefore offer additional opportunity
1111to declare a function or variable as ``constexpr ``.
12+ Furthermore, this check can be incremental in terms of its diagnostics. For
13+ example, declaring a function ``constepxr `` might create new opportunities of
14+ marking additional variables or function ``constexpr ``, which can only be found
15+ in subsequent runs of this check.
16+
17+ For variables, the check will only detect variables that can be declared
18+ ``constexpr `` if they are already ``const ``.
19+ This is because this check would have to duplicate the expensive analysis of the
20+ :doc: `misc-const-correctness<clang-tidy/checks/misc/const-correctness> ` check.
21+ Therefore, it is recommended to have
22+ :doc: `misc-const-correctness<clang-tidy/checks/misc/const-correctness> ` enabled
23+ in the Clang-Tidy config when this check is, so that all opportunities for
24+ ``const `` and also ``constexpr `` are explored.
1225
1326Options
1427-------
@@ -26,9 +39,9 @@ Options
2639 int &ref;
2740 };
2841
29- This type is a literal type, but can not be constructed at compile-time,
30- so with `ConservativeLiteralType ` equal to `true `, variables or funtions
31- with this type are not considered to support ``constexpr ``. Default is
42+ This type is a literal type, but can not be constructed at compile-time.
43+ With `ConservativeLiteralType ` equal to `true `, variables or funtions
44+ with this type are not diagnosed to add ``constexpr ``. Default is
3245 `true `.
3346
3447.. option :: AddConstexprToMethodOfClassWithoutConstexprConstructor
@@ -40,6 +53,12 @@ Options
4053
4154.. option :: ConstexprString
4255
43- The string to use to specify something as ``constexpr ``, for example, a macro.
44- Default is ``constexpr ``.
56+ The string to use to specify a variable or function as ``constexpr ``, for
57+ example, a macro. Default is ``constexpr ``.
58+
59+ .. option :: ConstexprString
60+
61+ The string to use with C++23 to specify a function-local variable as ``static
62+ constexpr ``, for example, a macro. Default is ``static constexpr ``
63+ (concatenating ``static `` with the `ConstexprString` option).
4564
0 commit comments