Re:Greppability is an underrated code metric
by camel-cdr on Tuesday September 03, 2024 @01:04PM
(#41436890)
Does it evaluate macros?
Because macros allow for arbitrary computation.
Re:Greppability is an underrated code metric
by umanwizard on Tuesday September 03, 2024 @02:19PM
(#41437564)
The macros I see in the real world seem to usually work fine. I’m sure it’s not perfect and you can construct a macro that would confuse it, but it’s a lot better than not having a compilation db at all.
Your other points make sense, but in this case, at least for C/C++, you can generate a compile_commands.json that will let clangd interpret your code accurately.
If building with make just do `bear -- make` instead of `make`. If building with cmake pass `-DCMAKE_EXPORT_COMPILE_COMMANDS=1`.