<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/80686>80686</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            [clang-tidy] Warn about wrong inline keyword placement
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            clang-tidy
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          SunBlack
      </td>
    </tr>
</table>

<pre>
    As #72397 already mention, the [inline keyword](https://en.cppreference.com/w/cpp/language/inline) is widely misunderstood. I feel like I've already seen all possible variants where the keyword can be added.

The new check [readability-redundant-inline-specifier](https://clang.llvm.org/extra/clang-tidy/checks/readability/redundant-inline-specifier.html) already detects code like this:

```cpp
class A
{
public:
 inline int test(){
    return 0;
  }
};

int main()
{
 A a;
    return a.test();
};
```

But it doesn't warn in cases like this (I believe one is redundant - I think the inline before the implementation is better):
```cpp
class A
{
public:
  inline int test();
};

inline int A::test(){
    return 0;
}

int main()
{
    A a;
    return a.test();
};
```

Another missing warning: In case the implementation is within the cpp the `inline` has no effect:
```cpp
// a.h
class A
{
public:
  inline int test();
};

// a.cpp
#include "a.h"

inline int A::test(){
    return 0;
}
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJy0VU2vqzYQ_TVmMwoiJgRYsEgaRcq6lbr2xwTcODayzaX595WBcLnSu9WT-ipFBPxxzsw59gzzXrUGsSHFmRSXhA2hs675fTBnzcQj4Va-mpMHQvOS5nUJTDtk8gVPNEFZQ-hvEDoEUpyV0cogPPA1WidJcSG06kLoPclPhF4JvaJJRd87vKNDIzAV9knodST0Kvqe0Ktmph1Yi4ReZzBCa1AeRiVRv-Cp_GAkOh-slSnc4I6oQasHwo3Q8gPX4DyiAaY19NZ7xTXCB3OKmeBh7NDhFPISKAhmgCMwKVGmJLuQ7DQ__-gQDI4gOhSPmGEEZ1xpFV47h3Iwkpmwm0Pd-R6Fuit0P8pcxNRSrT-eqXVtlOLv4Nh7YheUfMWPSOQJvW6Ipq_vqNIuPHUU6Z24xIAieBBW4qxM6NQUxiYvcszmX1R9GhGaeQ_v6fI8v_QD10qsm2ExWJkAAX0gtCK0XlcDADgMgzOQkXwdJOXlDXtZh-dnBHoyZRagr-RwAraBWbFZuuFe8bbY7-y2VOchgAogLXpDaBlgZM6AMiCYR_-pFBBa3YCjVviBYGO2Hlb9YQe3uMw8pgO06MHxbpcjpZ69xngzWLwbcS_HENBNsf5H9b-R_4cSLPKu608RJj_9rGufnv2ETwC_1qqTsaFDF2-7V6adnFKmJfkJbrNf30g9qmjNNCn6fq5Kx2wpJMcMOubBWMD7HUX4FzvmGwss7f5Xe1aaDXGujNCDRCCURn5Kf7Wh72wT2eSyzmuWYLMvs3J_yPdFmXTNkVOs8j3Pac3qgh5qijVyIZBX1UGIIlENzegho1mxP9CiKNNallXFa85lJe5YSnLI8MmUXstdorwfsKmyY3VMNOOo_dRuKN1WPxrbj2viph0fWk8OmVY--E-YoIKeGtVmW3GBP-NVZtwOAUZnTQtfGxH0monppCSD083Xutyq0A18aUSRaPnb9c7-FY8JvU7Bx6I8xf9PAAAA__-8HiOk">