This enables include insertion by adding canonical includes into
preambledata.
Details
Diff Detail
- Repository
- rL LLVM
Event Timeline
clangd/ClangdUnit.cpp | ||
---|---|---|
100 ↗ | (On Diff #184485) | Does this have to own the IWYUHandler? Could we create one when getCommentHandler is called? |
125 ↗ | (On Diff #184485) | This looks like a memory leak? release()? |
338 ↗ | (On Diff #184485) | I think so? A header file (with IWYU pragma) can also be the main file. |
unittests/clangd/CodeCompleteTests.cpp | ||
2287 ↗ | (On Diff #184485) | nit: maybe put this close to test cases that involve preamble. e.g. IndexSuppressesPreambleCompletions |
2301 ↗ | (On Diff #184485) | nit: just use std::string for readability. |
unittests/clangd/FileIndexTests.cpp | ||
207 ↗ | (On Diff #184485) | Are we sure the comment will be included in the preamble if there is no #include block? |
- Address comments.
- Call addSystemHeaderMappings when we are building ast without preamble.
clangd/ClangdUnit.cpp | ||
---|---|---|
100 ↗ | (On Diff #184485) | The class needs to own it, since preprocessor doesn't take the ownership. But we can move the creation to getcommenthandler. |
125 ↗ | (On Diff #184485) | Preprocessor doesn't take the ownership, so this seems to be correct ? |
338 ↗ | (On Diff #184485) | Also call addSystemHeadersMapping in case there is no preamble. |
lgtm.
Note that this will enable include insertions for everyone (even without index switched on). Not sure if we should provide options.
clangd/ClangdServer.cpp | ||
---|---|---|
16 ↗ | (On Diff #185030) | nit: is this used? |
I don't think so, since the only reason this already wasn't enabled was because there was a fixme ? Also we want people to use -background-index by default in future so I think it should be OK