diff options
Diffstat (limited to 'clang-tools-extra/docs/clang-tidy')
20 files changed, 63 insertions, 20 deletions
diff --git a/clang-tools-extra/docs/clang-tidy/checks/bugprone/compare-pointer-to-member-virtual-function.rst b/clang-tools-extra/docs/clang-tidy/checks/bugprone/compare-pointer-to-member-virtual-function.rst index a829329..cc711d6 100644 --- a/clang-tools-extra/docs/clang-tidy/checks/bugprone/compare-pointer-to-member-virtual-function.rst +++ b/clang-tools-extra/docs/clang-tidy/checks/bugprone/compare-pointer-to-member-virtual-function.rst @@ -56,6 +56,7 @@ virtual functions, thereby improving the overall stability and maintainability of your code. In scenarios involving pointers to member virtual functions, it's only advisable to employ ``nullptr`` for comparisons. + Limitations ----------- diff --git a/clang-tools-extra/docs/clang-tidy/checks/bugprone/copy-constructor-init.rst b/clang-tools-extra/docs/clang-tidy/checks/bugprone/copy-constructor-init.rst index cc3291b..02d3dde 100644 --- a/clang-tools-extra/docs/clang-tidy/checks/bugprone/copy-constructor-init.rst +++ b/clang-tools-extra/docs/clang-tidy/checks/bugprone/copy-constructor-init.rst @@ -35,7 +35,9 @@ outcomes. The check ensures that the copy constructor of a derived class properly calls the copy constructor of the base class, helping to prevent bugs and improve code quality. -Limitations: + +Limitations +----------- * It won't generate warnings for empty classes, as there are no class members (including base class sub-objects) to worry about. diff --git a/clang-tools-extra/docs/clang-tidy/checks/bugprone/crtp-constructor-accessibility.rst b/clang-tools-extra/docs/clang-tidy/checks/bugprone/crtp-constructor-accessibility.rst index 2e22f61..f24abfd 100644 --- a/clang-tools-extra/docs/clang-tidy/checks/bugprone/crtp-constructor-accessibility.rst +++ b/clang-tools-extra/docs/clang-tidy/checks/bugprone/crtp-constructor-accessibility.rst @@ -85,7 +85,9 @@ Example: CRTP<int> AlsoCompileTimeError; -Limitations: + +Limitations +----------- * The check is not supported below C++11 diff --git a/clang-tools-extra/docs/clang-tidy/checks/bugprone/nondeterministic-pointer-iteration-order.rst b/clang-tools-extra/docs/clang-tidy/checks/bugprone/nondeterministic-pointer-iteration-order.rst index 41be0bf..33cf79e 100644 --- a/clang-tools-extra/docs/clang-tidy/checks/bugprone/nondeterministic-pointer-iteration-order.rst +++ b/clang-tools-extra/docs/clang-tidy/checks/bugprone/nondeterministic-pointer-iteration-order.rst @@ -35,7 +35,9 @@ This check only detects range-based for loops over unordered sets and maps. It also detects calls sorting-like algorithms on containers holding pointers. Other similar usages will not be found and are false negatives. -Limitations: + +Limitations +----------- * This check currently does not check if a nondeterministic iteration order is likely to be a mistake, and instead marks all such iterations as bugprone. diff --git a/clang-tools-extra/docs/clang-tidy/checks/bugprone/redundant-branch-condition.rst b/clang-tools-extra/docs/clang-tidy/checks/bugprone/redundant-branch-condition.rst index a6fff9c..c2efff8 100644 --- a/clang-tools-extra/docs/clang-tidy/checks/bugprone/redundant-branch-condition.rst +++ b/clang-tools-extra/docs/clang-tidy/checks/bugprone/redundant-branch-condition.rst @@ -78,8 +78,9 @@ Every possible change is considered, thus if the condition variable is not a local variable of the function, it is a volatile or it has an alias (pointer or reference) then no warning is issued. -Known limitations -^^^^^^^^^^^^^^^^^ + +Limitations +----------- The ``else`` branch is not checked currently for negated condition variable: diff --git a/clang-tools-extra/docs/clang-tidy/checks/bugprone/sizeof-expression.rst b/clang-tools-extra/docs/clang-tidy/checks/bugprone/sizeof-expression.rst index 04824cc..09be75c 100644 --- a/clang-tools-extra/docs/clang-tidy/checks/bugprone/sizeof-expression.rst +++ b/clang-tools-extra/docs/clang-tidy/checks/bugprone/sizeof-expression.rst @@ -266,8 +266,9 @@ This check corresponds to the CERT C Coding Standard rule `ARR39-C. Do not add or subtract a scaled integer to a pointer <http://wiki.sei.cmu.edu/confluence/display/c/ARR39-C.+Do+not+add+or+subtract+a+scaled+integer+to+a+pointer>`_. + Limitations -""""""""""" +----------- Cases where the pointee type has a size of `1` byte (such as, and most importantly, ``char``) are excluded. diff --git a/clang-tools-extra/docs/clang-tidy/checks/bugprone/standalone-empty.rst b/clang-tools-extra/docs/clang-tidy/checks/bugprone/standalone-empty.rst index 8dc6046..8fdf2fc 100644 --- a/clang-tools-extra/docs/clang-tidy/checks/bugprone/standalone-empty.rst +++ b/clang-tools-extra/docs/clang-tidy/checks/bugprone/standalone-empty.rst @@ -30,7 +30,9 @@ A call to ``clear()`` would appropriately clear the contents of the range: ... v.clear(); -Limitations: + +Limitations +----------- * Doesn't warn if ``empty()`` is defined and used with the ignore result in the class template definition (for example in the library implementation). These diff --git a/clang-tools-extra/docs/clang-tidy/checks/misc/const-correctness.rst b/clang-tools-extra/docs/clang-tidy/checks/misc/const-correctness.rst index b13367a..93a5762 100644 --- a/clang-tools-extra/docs/clang-tidy/checks/misc/const-correctness.rst +++ b/clang-tools-extra/docs/clang-tidy/checks/misc/const-correctness.rst @@ -52,8 +52,9 @@ Note that there is the check :doc:`cppcoreguidelines-avoid-non-const-global-variables <../cppcoreguidelines/avoid-non-const-global-variables>` to enforce ``const`` correctness on all globals. -Known Limitations ------------------ + +Limitations +----------- The check does not run on `C` code. diff --git a/clang-tools-extra/docs/clang-tidy/checks/misc/no-recursion.rst b/clang-tools-extra/docs/clang-tidy/checks/misc/no-recursion.rst index c8281075..1c04dbf 100644 --- a/clang-tools-extra/docs/clang-tidy/checks/misc/no-recursion.rst +++ b/clang-tools-extra/docs/clang-tidy/checks/misc/no-recursion.rst @@ -14,7 +14,9 @@ References: * JPL Institutional Coding Standard for the C Programming Language (JPL DOCID D-60411) rule `2.4 Do not use direct or indirect recursion`. * OpenCL Specification, Version 1.2 rule `6.9 Restrictions: i. Recursion is not supported. <https://www.khronos.org/registry/OpenCL/specs/opencl-1.2.pdf>`_. -Limitations: + +Limitations +----------- * The check does not handle calls done through function pointers * The check does not handle C++ destructors diff --git a/clang-tools-extra/docs/clang-tidy/checks/modernize/loop-convert.rst b/clang-tools-extra/docs/clang-tidy/checks/modernize/loop-convert.rst index 3f4783e..58d61d1 100644 --- a/clang-tools-extra/docs/clang-tidy/checks/modernize/loop-convert.rst +++ b/clang-tools-extra/docs/clang-tidy/checks/modernize/loop-convert.rst @@ -175,6 +175,7 @@ Options A string specifying which include-style is used, `llvm` or `google`. Default is `llvm`. + Limitations ----------- diff --git a/clang-tools-extra/docs/clang-tidy/checks/modernize/pass-by-value.rst b/clang-tools-extra/docs/clang-tidy/checks/modernize/pass-by-value.rst index e884cf3..b8d933a 100644 --- a/clang-tools-extra/docs/clang-tidy/checks/modernize/pass-by-value.rst +++ b/clang-tools-extra/docs/clang-tidy/checks/modernize/pass-by-value.rst @@ -85,8 +85,8 @@ untouched: }; -Known limitations -^^^^^^^^^^^^^^^^^ +Limitations +----------- A situation where the generated code can be wrong is when the object referenced is modified before the assignment in the init-list through a "hidden" reference. diff --git a/clang-tools-extra/docs/clang-tidy/checks/modernize/replace-auto-ptr.rst b/clang-tools-extra/docs/clang-tidy/checks/modernize/replace-auto-ptr.rst index 8732131..8a8c30e 100644 --- a/clang-tools-extra/docs/clang-tidy/checks/modernize/replace-auto-ptr.rst +++ b/clang-tools-extra/docs/clang-tidy/checks/modernize/replace-auto-ptr.rst @@ -31,8 +31,10 @@ Since ``std::move()`` is a library function declared in ``<utility>`` it may be necessary to add this include. The check will add the include directive when necessary. -Known Limitations ------------------ + +Limitations +----------- + * If headers modification is not activated or if a header is not allowed to be changed this check will produce broken code (compilation error), where the headers' code will stay unchanged while the code using them will be changed. diff --git a/clang-tools-extra/docs/clang-tidy/checks/modernize/replace-disallow-copy-and-assign-macro.rst b/clang-tools-extra/docs/clang-tidy/checks/modernize/replace-disallow-copy-and-assign-macro.rst index 016be67..5ef6ae7 100644 --- a/clang-tools-extra/docs/clang-tidy/checks/modernize/replace-disallow-copy-and-assign-macro.rst +++ b/clang-tools-extra/docs/clang-tidy/checks/modernize/replace-disallow-copy-and-assign-macro.rst @@ -33,8 +33,9 @@ It will be transformed to this: const Foo &operator=(const Foo &) = delete; }; -Known Limitations ------------------ + +Limitations +----------- * Notice that the migration example above leaves the ``private`` access specification untouched. You might want to run the check :doc:`modernize-use-equals-delete diff --git a/clang-tools-extra/docs/clang-tidy/checks/modernize/type-traits.rst b/clang-tools-extra/docs/clang-tidy/checks/modernize/type-traits.rst index 0716160..91be4fb 100644 --- a/clang-tools-extra/docs/clang-tidy/checks/modernize/type-traits.rst +++ b/clang-tools-extra/docs/clang-tidy/checks/modernize/type-traits.rst @@ -39,6 +39,7 @@ Options Defaults to `false`. + Limitations ----------- diff --git a/clang-tools-extra/docs/clang-tidy/checks/modernize/use-auto.rst b/clang-tools-extra/docs/clang-tidy/checks/modernize/use-auto.rst index 3aa5c6b..6753617 100644 --- a/clang-tools-extra/docs/clang-tidy/checks/modernize/use-auto.rst +++ b/clang-tools-extra/docs/clang-tidy/checks/modernize/use-auto.rst @@ -166,8 +166,9 @@ that behave as casts, such as ``llvm::dyn_cast``, ``boost::lexical_cast`` and casts if the first template argument is explicit and is a type, and the function returns that type, or a pointer or reference to it. -Known Limitations ------------------ + +Limitations +----------- * If the initializer is an explicit conversion constructor, the check will not replace the type specifier even though it would be safe to do so. diff --git a/clang-tools-extra/docs/clang-tidy/checks/modernize/use-trailing-return-type.rst b/clang-tools-extra/docs/clang-tidy/checks/modernize/use-trailing-return-type.rst index 2dac7cc..63b8885 100644 --- a/clang-tools-extra/docs/clang-tidy/checks/modernize/use-trailing-return-type.rst +++ b/clang-tools-extra/docs/clang-tidy/checks/modernize/use-trailing-return-type.rst @@ -27,8 +27,9 @@ transforms to: virtual auto f3() const && -> float = delete; auto lambda = []() -> void {}; -Known Limitations ------------------ + +Limitations +----------- The following categories of return types cannot be rewritten currently: diff --git a/clang-tools-extra/docs/clang-tidy/checks/performance/unnecessary-copy-initialization.rst b/clang-tools-extra/docs/clang-tidy/checks/performance/unnecessary-copy-initialization.rst index bb4f42c..0e9d547 100644 --- a/clang-tools-extra/docs/clang-tidy/checks/performance/unnecessary-copy-initialization.rst +++ b/clang-tools-extra/docs/clang-tidy/checks/performance/unnecessary-copy-initialization.rst @@ -59,3 +59,22 @@ Options types that don't own the underlying data. Like for `AllowedTypes` above, regular expressions are accepted and the inclusion of `::` determines whether the qualified typename is matched or not. + + +Limitations +----------- + +This check does not perform lifetime analysis and may suggest replacing copies +with const references that could become dangling. Be cautious when the +referenced object might be invalidated by subsequent operations. + +.. code-block:: c++ + + void consume(const S&); + + void func(std::vector<S> &Vec) { + const auto It = Vec.begin(); + const S Value(*It); // The warning will suggest making this a const reference. + Vec.erase(It); // Container modifications could invalidate references. + consume(Value); // Safe with copy, dangling reference otherwise. + } diff --git a/clang-tools-extra/docs/clang-tidy/checks/readability/function-cognitive-complexity.rst b/clang-tools-extra/docs/clang-tidy/checks/readability/function-cognitive-complexity.rst index ffd2b2c..3710917 100644 --- a/clang-tools-extra/docs/clang-tidy/checks/readability/function-cognitive-complexity.rst +++ b/clang-tools-extra/docs/clang-tidy/checks/readability/function-cognitive-complexity.rst @@ -154,6 +154,7 @@ set to `2` or smaller. If the option DescribeBasicIncrements is set to `true`, it will additionally flag the two `if` statements with the amounts by which they increase to the complexity of the function and the current nesting level. + Limitations ----------- diff --git a/clang-tools-extra/docs/clang-tidy/checks/readability/misleading-indentation.rst b/clang-tools-extra/docs/clang-tidy/checks/readability/misleading-indentation.rst index 8b6655c..cac55dd 100644 --- a/clang-tools-extra/docs/clang-tidy/checks/readability/misleading-indentation.rst +++ b/clang-tools-extra/docs/clang-tidy/checks/readability/misleading-indentation.rst @@ -31,6 +31,7 @@ Examples: foo1(); foo2(); // Not guarded by if(cond1). + Limitations ----------- diff --git a/clang-tools-extra/docs/clang-tidy/checks/readability/qualified-auto.rst b/clang-tools-extra/docs/clang-tidy/checks/readability/qualified-auto.rst index 34390e2..d031b67 100644 --- a/clang-tools-extra/docs/clang-tidy/checks/readability/qualified-auto.rst +++ b/clang-tools-extra/docs/clang-tidy/checks/readability/qualified-auto.rst @@ -119,6 +119,7 @@ Note in the LLVM alias, the default value is `false`. Otherwise no changes will occur. + Limitations ----------- |