[llvm] [LLVM] Automatically strip `-fno-lifetime-dse` from compile_commands.json (PR #124623)

Joseph Huber via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 28 15:13:03 PST 2025


jhuber6 wrote:

> I don't understand the issue, the `command` field for each file in the compilation database should include a full compiler invocation, so if you merge compilation database from both the LLVM and runtime builds, so you should end up with something like:
> 
> ```
> [
>   ...
>   {
>     "command": "/usr/bin/g++ ... -fno-lifetime-dse",
>     ...
>   },
>   ...
>   {
>     "command": "/path/to/build/bin/clang ...",
>     ...
>   },
>   ...
> ]
> ```
> 
> It sounds like you also end up with `/path/to/build/bin/clang ... -fno-lifetime-dse` entries in the database. Where do those come from?

They're added by the LLVM build itself, you cannot turn them off. It was done in the past as a fix for some GNU LTO bug. https://github.com/llvm/llvm-project/blob/381218950e9c0fc17256e1fe4093fd108acc2ac4/llvm/cmake/modules/HandleLLVMOptions.cmake#L698.

I suppose in my case I could just force building with system clang all the time instead, but it's annoying in general.

https://github.com/llvm/llvm-project/pull/124623


More information about the llvm-commits mailing list