================
@@ -123,6 +136,117 @@ class IndexActionFactory : public
tooling::FrontendActionFactory {
RelationSlab::Builder Relations;
};
+// Action factory that writes per-file shards (for background index format).
+class BackgroundIndexActionFactory : public tooling::FrontendActionFactory {
+public:
+ BackgroundIndexActionFactory(BackgroundIndexStorage &Storage)
+ : Storage(Storage), Symbols(std::make_unique<SymbolSlab::Builder>()),
+ Refs(std::make_unique<RefSlab::Builder>()),
+ Relations(std::make_unique<RelationSlab::Builder>()) {}
+
+ std::unique_ptr<FrontendAction> create() override {
+ SymbolCollector::Options Opts;
+ Opts.CountReferences = true;
+ Opts.FileFilter = [&](const SourceManager &SM, FileID FID) {
+ const auto F = SM.getFileEntryRefForID(FID);
+ if (!F)
+ return false;
+ auto AbsPath = getCanonicalPath(*F, SM.getFileManager());
+ if (!AbsPath)
+ return false;
+ std::lock_guard<std::mutex> Lock(FilesMu);
+ return Files.insert(*AbsPath).second;
+ };
+ return createStaticIndexingAction(
----------------
jasonwilliams wrote:
I've re-organised it into a baseclass which shares logic. Due to the membership
of Symbols most of the logic is still separate but i've put the calls into the
base class so its more clear what is happening
https://github.com/llvm/llvm-project/pull/175209
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits