xref: /llvm-project/clang-tools-extra/clangd/index/IndexAction.h (revision 4d006520b8c0cc3a52913b4665bf741c737e5592)
1321d5d48SSam McCall //===--- IndexAction.h - Run the indexer as a frontend action ----*- C++-*-===//
2321d5d48SSam McCall //
32946cd70SChandler Carruth // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
42946cd70SChandler Carruth // See https://llvm.org/LICENSE.txt for license information.
52946cd70SChandler Carruth // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6321d5d48SSam McCall //
7321d5d48SSam McCall //===----------------------------------------------------------------------===//
8321d5d48SSam McCall 
95bd643d3SChristian Kühnel #ifndef LLVM_CLANG_TOOLS_EXTRA_CLANGD_INDEX_INDEXACTION_H
105bd643d3SChristian Kühnel #define LLVM_CLANG_TOOLS_EXTRA_CLANGD_INDEX_INDEXACTION_H
115399552dSKadir Cetinkaya #include "Headers.h"
12*4d006520SSam McCall #include "index/SymbolCollector.h"
13*4d006520SSam McCall #include "clang/Frontend/FrontendAction.h"
14321d5d48SSam McCall 
15321d5d48SSam McCall namespace clang {
16321d5d48SSam McCall namespace clangd {
17321d5d48SSam McCall 
18321d5d48SSam McCall // Creates an action that indexes translation units and delivers the results
19321d5d48SSam McCall // for SymbolsCallback (each slab corresponds to one TU).
20321d5d48SSam McCall //
21321d5d48SSam McCall // Only a subset of SymbolCollector::Options are respected:
22321d5d48SSam McCall //   - include paths are always collected, and canonicalized appropriately
23321d5d48SSam McCall //   - references are always counted
247dd4950eSHaojian Wu //   - all references are collected (if RefsCallback is non-null)
25a7cdfd9cSKadir Cetinkaya //   - the symbol origin is set to Static if not specified by caller
265399552dSKadir Cetinkaya std::unique_ptr<FrontendAction> createStaticIndexingAction(
275399552dSKadir Cetinkaya     SymbolCollector::Options Opts,
28cc21779cSSam McCall     std::function<void(SymbolSlab)> SymbolsCallback,
295399552dSKadir Cetinkaya     std::function<void(RefSlab)> RefsCallback,
30f1e6f571SNathan Ridge     std::function<void(RelationSlab)> RelationsCallback,
315399552dSKadir Cetinkaya     std::function<void(IncludeGraph)> IncludeGraphCallback);
32321d5d48SSam McCall 
33321d5d48SSam McCall } // namespace clangd
34321d5d48SSam McCall } // namespace clang
35321d5d48SSam McCall 
36321d5d48SSam McCall #endif
37