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

    <tr>
        <th>Summary</th>
        <td>
            [libc] `llvmlibc-inline-function-decl` erroneously reports on lambda functions
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            libc
      </td>
    </tr>

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

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

<pre>
    The `llvmlibc-inline-function-decl` currently  erroneously reports when defining a lambda function. The reason LLVM's `libc` reports on these variables so that we can ensure functions in headers line up when compiled differently for different TUs. However, the functions emitted from `lambda` values will have internal linkage, so they will be unique to each TU they are implemented in. Here is a reproducer.

```c++
namespace __llvm_libc {

void foo(void (*fn)(void));

void bar() {
  foo([]() {});
}

} // namespace __llvm_libc
```
```shell
$ clang-tidy test.h --checks=-'*,llvmlibc*'               
8 warnings generated.
test.h:6:7: warning: '__invoke' must be tagged with the LIBC_INLINE macro; the macro should be placed at the beginning of the declaration [llvmlibc-inline-function-decl]
  foo([]() {});
 ^
test.h:6:7: warning: 'operator void (*)()' must be tagged with the LIBC_INLINE macro; the macro should be placed at the beginning of the declaration [llvmlibc-inline-function-decl]
test.h:6:7: warning: '~(lambda at /home/jhuber/Documents/llvm/llvm-project/build/test.h:6:7)' must be tagged with the LIBC_INLINE macro; the macro should be placed at the beginning of the declaration [llvmlibc-inline-function-decl]
test.h:6:10: warning: 'operator()' must be tagged with the LIBC_INLINE macro; the macro should be placed at the beginning of the declaration [llvmlibc-inline-function-decl]
  foo([]() {});
 ^
Suppressed 4 warnings (4 with check filters).
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzUVktz2zYQ_jXQZUcaEnwfdJCsaOIZN5c6vWpAYEkiBgEWAKXxpb-9A1CubTVpk1ui4VB4fvv6dpfMOdlrxC0p9oRSJ8-MD0wLywilp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