How to generate compile_commands.json for clang?

Hi,
I’m new to clang.
I follow the get_started to build clang (on linux).
However, if I add -DCMAKE_EXPORT_COMPILER_COMMANDS to the cmake command, the resulted compile_commands.json only contains llvm related cpp.
What should I do to get that of clang?
Thanks for any help!

Hi Guangqing,

Does ‘ninja clang’ (or ‘make clang’) produce any results?
Did you specify ‘-DLLVM_ENABLE_PROJECTS=clang’ in your initial CMake run?

I remove CMakeCache.txt and try again
it works :slight_smile:
Thanks for your reply.

However, my YCM still not work in clang’s cpp even with compile_commands.json:
‘HTTPConnectionPool(): Read timed out. (read timeout=30)’
(my YCM work well in llvm’s cpp with compile_commands.json)

Ilya Biryukov <ibiryukov@google.com> 于2019年4月1日周一 下午5:48写道: