brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.0 KiB · f8f3479 Raw
58 lines · plain
1.. title:: clang-tidy - modernize-use-override2 3modernize-use-override4======================5 6Adds ``override`` (introduced in C++11) to overridden virtual functions and7removes ``virtual`` from those functions as it is not required.8 9``virtual`` on non base class implementations was used to help indicate to the10user that a function was virtual. C++ compilers did not use the presence of11this to signify an overridden function.12 13In C++11 ``override`` and ``final`` keywords were introduced to allow14overridden functions to be marked appropriately. Their presence allows15compilers to verify that an overridden function correctly overrides a base16class implementation.17 18This can be useful as compilers can generate a compile time error when:19 20 - The base class implementation function signature changes.21 - The user has not created the override with the correct signature.22 23Options24-------25 26.. option:: IgnoreDestructors27 28   If set to `true`, this check will not diagnose destructors. Default is `false`.29 30.. option:: IgnoreTemplateInstantiations31 32   If set to `true`, instructs this check to ignore virtual function overrides33   that are part of template instantiations. Default is `false`.34 35.. option:: AllowOverrideAndFinal36 37   If set to `true`, this check will not diagnose ``override`` as redundant38   with ``final``. This is useful when code will be compiled by a compiler with39   warning/error checking flags requiring ``override`` explicitly on overridden40   members, such as ``gcc -Wsuggest-override``/``gcc -Werror=suggest-override``.41   Default is `false`.42 43.. option:: OverrideSpelling44 45   Specifies a macro to use instead of ``override``. This is useful when46   maintaining source code that also needs to compile with a pre-C++1147   compiler.48 49.. option:: FinalSpelling50 51   Specifies a macro to use instead of ``final``. This is useful when52   maintaining source code that also needs to compile with a pre-C++1153   compiler.54 55.. note::56 57   For more information on the use of ``override`` see https://en.cppreference.com/w/cpp/language/override58