[PATCH] D38639: [clangd] #include statements support for Open definition
Ilya Biryukov via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Oct 23 05:22:12 PDT 2017
ilya-biryukov added inline comments.
================
Comment at: clangd/ClangdUnit.cpp:103
+ void AfterExecute(CompilerInstance &CI) override {
+ const SourceManager &SM = CI.getSourceManager();
----------------
Nebiroth wrote:
> ilya-biryukov wrote:
> > There's a much better public API to get all includes that were encountered by the `Preprocessor`: we need to override `PPCallbacks ::InclusionDirective`.
> >
> >
> > `PrecompiledPreamble` does not currently expose this callbacks, but could you add to `PreambleCallbacks` in a separate commit?
> >
> If I were to use InclusionDirective , how would that callback be called automatically? As far as I know, it wouldn't be called automatically for every file that gets indexed the same way AfterExecute would be.
It will be called for each `#include` directive that Preprocessor encountered while building the preamble.
A separate instance of `CppFilePreambleCallbacks` is created every time we build a preamble for file.
Does that answer your question?
https://reviews.llvm.org/D38639
More information about the cfe-commits
mailing list