[cfe-dev] clangd, completion in header files

Christian Dullweber via cfe-dev cfe-dev at lists.llvm.org
Wed Mar 28 05:03:17 PDT 2018


Hi,

I recently tried to use clangd for Chromium in vscode and hit the same
issue.
I experimented a bit with generating a compile_commands.json file with
valid rules for headers and came to this solution:
https://gist.github.com/xchrdw/bfd2b3a5f765f4195a55d6351daf1b48
I sorted all .cc filenames and then looked up the index of the closest match
 for each header using binary search. As there were some edge cases like
the first or last file in a directory, I additionally compared which file
at the index has the largest prefix with the header.
I found a few issues with system headers and some generated protobuf
headers but otherwise it works well.
Native support from clangd would be amazing :)

Thanks,
Christian
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20180328/984f9fab/attachment.html>


More information about the cfe-dev mailing list