<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/60984>60984</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Make libc code lint clean
</td>
</tr>
<tr>
<th>Labels</th>
<td>
code-cleanup,
libc
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
sivachandra,
lntue,
michaelrj-google
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
sivachandra
</td>
</tr>
</table>
<pre>
After https://reviews.llvm.org/D144705, it is possible to run linting on the libc source code again. Because of the long time since we last did any formal lint checking, the source tree has regressed in a number of places with respect to code style. Also, the new `LIBC_INLINE` tag is missing in a number of places. This is issue is about making the libc source lint clean so that we can start running linting on a CI builder.
Addressing this bug has to be a team effort as a large part of the source tree is affected. The best way to start doing the cleanup is this:
1. Build clang and clang-tidy from head and install it into a special directory, say `~/libc-lint-tools/`.
2. Configure libc with:
```
cmake -G Ninja ../llvm -DLLVM_ENABLE_PROJECTS="libc" -DCMAKE_BUILD_TYPE=Debug -DLLVM_LIBC_FULL_BUILD=ON
-DCMAKE_CXX_COMPILER=~/libc-lint-tools/bin/clang++ -DCMAKE_C_COMPILER=~/libc-lint-tools/bin/clang
-DLLVM_LIBC_CLANG_TIDY=~/libc-lint-tools/bin/clang-tidy
```
3. Build any lint target, for example, `libc.src.string.strlen.__lint__` or just execute the `libc-lint` target. They should you a large number of lint problems.
4. Send patches to problems identified in step 3.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyUVVGP2jgQ_jXmZUQUnLDAAw9AoOKOpVW7PbVPyLEnibeOjWxnt7zcbz9NCMuerifdSWiTbPLNfPPNN2MRgq4t4pJN14zzoF-EbIRVXjDOGd8wzo2NHb49tVo2Ao1_HtfO1aZ_MS1GoouN88t3-FHp1GW5qiJ6aGI8B5atGN8xvvP4ovE1JMa8tInzNeO7YpLns3TK-AZ0BB3g7ELQpUGIDnxnwWgbta3BWYgNgtGlhOA6LxGkUwi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