llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
27.15k stars 11.12k forks source link

Clang-tidy hangs #63101

Open alexolog opened 1 year ago

alexolog commented 1 year ago

We have a project that consists of several sub-projects which is built using CMake and Ninja. Clang-Tidy is invoked via CMAKE_CXX_CLANG_TIDY.

Compiling the project without Clang-Tidy takes a couple of minutes. With Clang-Tidy 15, it takes about half an hour. Clang 16 just hangs when it reaches one of the sub-projects and needs to be killed after many hours of running without producing any output (6 processes consuming 100% CPU each on an M1 Mac).

CMAKE_VERBOSE_MAKEFILE is not helping.

I am not sure how to get more information, as I am not very familiar with the tool (it is usually invoked automatically by CMake), so any suggestion is appreciated!

llvmbot commented 1 year ago

@llvm/issue-subscribers-clang-tidy

EugeneZelenko commented 1 year ago

Could you please try disable some checks? You could start form disabling by group and then fine-grain to fine offender. .clang-tidy is most common place to find configuration.

See also https://clang.llvm.org/extra/clang-tidy/index.html.

PiotrZSL commented 1 year ago

Most probably caused by bugprone-unchecked-optional-access check.

alexolog commented 1 year ago

I'll try to check it, but that particular check is useful, will be a shame to disable it.

alexolog commented 1 year ago

I am running clangd 16 in VSCode with clang-tidy enabled, and it does not seem to suffer from the same problem. Could it be happening during the link phase?

EugeneZelenko commented 1 year ago

Clang-tidy is compiler frontend-based tools, so linking is irrelevant.