[clang-tools-extra] [clang] [clang-tidy] Added new check to detect redundant inline keyword (PR #73069)
via cfe-commits
cfe-commits at lists.llvm.org
Wed Nov 22 07:53:29 PST 2023
º×ü¨P·ÙbÄ í¢)Þ
쵩ís²Æ xÈ©$è[梸?[æþYoèç-þ¥þ÷Ó¯`ØnmÊ&
================
@@ -0,0 +1,35 @@
+.. title:: clang-tidy - readability-redundant-inline-specifier
+
+readability-redundant-inline-specifier
+======================================
+
+Checks for instances of the `inline` keyword in code where it is redundant
+and recommends its removal.
+
+Examples:
+
+.. code-block:: c++
+
+ constexpr inline void f() {}
+
+In the example abvove the keyword `inline` is redundant since constexpr
+functions are implicitly inlined
+
+.. code-block:: c++
+
+ class MyClass {
+ inline void myMethod() {}
+ };
+
+In the example above the keyword `inline` is redundant since member functions
+defined entirely inside a class/struct/union definition are implicitly inlined.
+
+The token `inline` is considered redundant in the following cases:
+
+- When it is used in a function definition that is constexpr.
+- When it is used in a member function definition that is defined entirely
+ inside a class/struct/union definition.
+- When it is used on a deleted function.
+- When it is used on a template declaration.
+- When it is used on a member variable that is constexpr and static.
+
----------------
EugeneZelenko wrote:
Not needed.
https://github.com/llvm/llvm-project/pull/73069
More information about the cfe-commits
mailing list