Hello clang devs,
I use YouCompleteMe as a semantic completion engine for vim, which in turn uses libclang to provide completions. By default, YCM uses the 3.4 version of libclang, and all works well. However, I recently updated it to use the head version and now I’m seeing errors like that listed in the subject. I’ve been able to create a minimal reproduction - see the attached files.
To execute run commands similar to the following:
tar xvf clang_parse.tar.gz
cmake -D CMAKE_BUILD_TYPE=Release -G “Unix Makefiles” -D PATH_TO_LLVM_ROOT=<path to llvm head install dir - should have include and lib under here> …/src/
The basic test case is this:
- Write the small cpp and h files to disk.
- Parse the translation unit - observe that the syntax error is reported
- Immediately reparse the TU.
- Update the header in memory and reparse - observe that the syntax error is gone.
- Save the header to disk and reparse. Observe the “file ‘/tmp/header_file.h’ has been modified since the precompiled header ‘/some/path/preamble-eb3c0c.pch’ was built” error.
Am I using these methods incorrectly, or is there a bug in clang? If I’m using them incorrectly, what is the correct way to reparse a translation unit that has changed?
clang_parse.tar.gz (1.57 KB)