First line of .ccls is incorrect

Warning: I barely know what I’m talking about…

My set up is using Emacs with various packages such as lsp-mode, platformio-mode, projectile, flymake, and ccls. I’m working on a “Cheap Yellow Display” which is using an ESP32 SoC.

The set up was working mostly but I had odd complaints from flymake. One clue in particular was when I tried to use the RTC_DATA_ATTR macro and the complaint was that the section on a mach-o needed to have two arguments. Of course, my target was using elf so that clued me in that ccls didn’t know about the target platform.

The first line of .ccls created by pio project init --ide emacs is clang but that is wrong. That will use the clang (probably) of the platform you are developing on; not the platform you are targeting. In my case I changed it to /Users/<user name>.platformio/packages/toolchain-xtensa-esp32/bin/xtensa-esp32-elf-gcc and that has (so far) cleaned up all of my weird errors.

The call to pio project init probably knows which compiler it will be using and so it seems like it could properly populate this line. I believe this is a bug but I feel way too unqualified to be sure.