No clangd inspections for folder which are added through 'Mark Directory as -> Project Files and Sources'

I am working on a large and very old project which does not formally use Cmake. Clion has been allowing me to index it and use all the advanced IDE features by simply marking a directory as 'Project Files and Sources'.

This would also enable CLion's built in inspections and, a few versions back, even the clangd warnings and errors would also work as well.

As of 2020.2 (if I remember correctly), the clangd warnings and errors stopped showing, and the file only displayed a green check mark:

If I'd switch off clangd, the built-in inspections and errors would be shown instead.

Initially, I thought that this was the bug reported here: Clangd-based code analysis doesn't work : CPP-22209 (jetbrains.com)

So I patiently waited for a fix, but now I managed to update to Clion 2020.3.3, and yet the clangd warnings would still not work.

I realized to try and add my source file to a Cmakelists.txt and voila, the clangd warnings and errors are immediately shown, as soon as Cmake finishes reloading:

Isn't clangd supposed to work with source files which are simply marked as 'Project Files and Sources', and not added to a Cmakelists.txt as well, just like the built-in inspections work?

 

Build #CL-203.7717.62, built on March 15, 2021
Runtime version: 11.0.10+8-b1145.96 amd64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
Windows 10 10.0
GC: ParNew, ConcurrentMarkSweep
Memory: 19987M
Cores: 12
Registry: run.processes.with.pty=TRUE, cidr.max.intellisense.file.length=1000000, clion.clang.clangd.debug=1
Non-Bundled Plugins: CMD Support, in.xiv.cs, com.perl5

1 comment
Comment actions Permalink

Hi Andrei!

On what build system is your project based? Is it possible to generate a compilation database for your project - https://www.jetbrains.com/help/clion/compilation-database.html?

0

Please sign in to leave a comment.