This is an archive of the discontinued LLVM Phabricator instance.

[Index] Stopped wrapping FrontendActions in libIndex and its users
ClosedPublic

Authored by gribozavr on Aug 28 2019, 6:34 AM.

Details

Summary

Exposed a new function, createIndexingASTConsumer, that creates an
ASTConsumer. ASTConsumers compose well.

Removed wrapping functionality from createIndexingAction.

Event Timeline

gribozavr created this revision.Aug 28 2019, 6:34 AM

Overall LG, thanks! Not sure why we need to keep IndexingOptions everywhere, though, see the relevant comment.

clang-tools-extra/clangd/index/IndexAction.cpp
217

Are these option ever used? Do we need to keep them alive for the lifetime of the action?
Might be worth a comment.

clang-tools-extra/clangd/unittests/SymbolCollectorTests.cpp
227

Same here, we do not seem to use Opts, but still store them. To keep them alive?

gribozavr marked 4 inline comments as done.Aug 28 2019, 7:12 AM
gribozavr added inline comments.
clang-tools-extra/clangd/index/IndexAction.cpp
217

They are passed in through the constructor, and consumed by index::createIndexingASTConsumer in CreateASTConsumer. So they need to be stored in a member variable between those two calls.

clang-tools-extra/clangd/unittests/SymbolCollectorTests.cpp
227

Same as in the other comment -- Opts are passed in through the constructor of IndexAction, and consumed in IndexAction::CreateASTConsumer.

ilya-biryukov accepted this revision.Aug 28 2019, 10:32 AM
ilya-biryukov marked an inline comment as done.

LGTM

clang-tools-extra/clangd/index/IndexAction.cpp
217

Ah, missed that at first glance. Thanks for the explanation, LG.

This revision is now accepted and ready to land.Aug 28 2019, 10:32 AM
gribozavr marked 2 inline comments as done.Aug 29 2019, 4:46 AM

Committed as r370337.

gribozavr closed this revision.Aug 29 2019, 4:47 AM