irony-mode
irony-mode copied to clipboard
Input file not stripped from compile options causing crash in irony-server
When editing files through symlinks or editing files that are present as a symlink in the compilation database, irony-server get-compile-options compares true names and resolves to the proper entry in the compilation database. irony-cdb-json--adjust-compile-options expects to remove the exact filename and fails to do so.
For example
compile_commands.json has an entry for /path/to/project/symlink-to-submodule/file.c
/path/to/project/symlink-to-submodule/file.c
is a symlink to /path/to/project/.submodules/subproject/lib/file.c
When calling irony-server get-compile-options /path/to/project/.submodules/subproject/lib/file.c
we'll get back the entry for /path/to/project/symlink-to-submodule/file.c
When irony-cdb-json--adjust-compile-options
is called on the list of arguments, the buffer filename and the source file in the list of options -c /path/to/project/symlink-to-submodule/file.c
will be different and the file doesn't get stripped.
This causes irony-server to crash during parse.
Solution is either to remove the pair '-c /path/to/file' entirely like is done for -o instead of doing it piecewise. An alternative would be to compare true names but I don't think it required.