Sarcasm / irony-mode

A C/C++ minor mode for Emacs powered by libclang
GNU General Public License v3.0
901 stars 98 forks source link

Irony using wrong file, right directory from compile_commands.json #521

Open LukeFernandes opened 5 years ago

LukeFernandes commented 5 years ago

I seem to have got Irony to work with a large project (RawTherapee), however when I try to open a file from a particular source directory, it loads the compile flags from the first file it sees (alphabetically) in that directory and not those of the actual file.

Build --->rtexif (JSON working directory) --------->rtgui (JSON working directory) --------->rtengine (JSON working directory)

Src ------>rtexif ---------->rtgui ---------->rtengine--->CA_correct_RT.cc ------------------------>etc. ------------------------>ipsharpen.cc ------------------------>etc. etc. 50-ish more cpp files here

When I load 'ipsharpen.cc', the compilation flags are those for 'CA_correct_RT.cc', which is the first rtengine file in the database. The same applies to all other files in rtengine AFAIK.

What's more, when I do 'M-x check-compile-options RET' (found from looking at issue #190) I get the same list of compile options and it says it found them by guessing. Shouldn't it find them properly?

And when I do (irony-cdb-json--find-best-prefix-path (irony-cdb-json--target-path) '("C:/code/repo-rt/rtengine")) I get nil, which I don't think is right, is it?

compile_commands.txt I've attached compile-commands.json (as a text file for upload).