Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@Rahlir
Copy link
Contributor

@Rahlir Rahlir commented Feb 4, 2019

This little error caused that when parsing compile_commands json, the
filename was used to fetch entries in dir_lookup dictionary (dirname is supposed to be used), hence, when
adding new json commands, it never found anything in dir_lookup and
instead rewrote the previous entry. Hence, the dir_lookup always
contained list of only one compile_command per directory instead of all
compile_commands for given directory.

Someone evidently didn't check his/her code when implementing the parse_compile_command code and this super minor code inaccuracy caused me quite a headache whenever my c++ project had multiple compile commands per one directory.

Just to be clear what is fixed here: before, in line 205 in c.vim the json entry for filename was fetched and then json entry for directory name was appended to that entry. However, since the dictionary used here was the one that used directory names as keys, the json entry for filename was always empty. What wasn't empty was entry with the same directory key, but that entry was overwritten with the new json entry for the same directory. Hence, in the line 205 the json entry for the given dirname was always overwriting the previous entry instead of appending it.

This little error caused that when parsing compile_commands json, the
filename was used to fetch entries in directory dictionary, hence, when
adding new json commands, it never found anything in dir_lookup and
instead rewrote the previous entry. Hence, the dir_lookup always
contained list of only one compile_command per directory instead of all
compile_commands for given directory.
@w0rp w0rp merged commit 3ba7d02 into dense-analysis:master Feb 8, 2019
@w0rp
Copy link
Member

w0rp commented Feb 8, 2019

Cheers! 🍻

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants