1 //===--- IndexAction.h - Run the indexer as a frontend action ----*- C++-*-===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 #ifndef LLVM_CLANG_TOOLS_EXTRA_CLANGD_INDEX_INDEXACTION_H
10 #define LLVM_CLANG_TOOLS_EXTRA_CLANGD_INDEX_INDEXACTION_H
12 #include "index/SymbolCollector.h"
13 #include "clang/Frontend/FrontendAction.h"
18 // Creates an action that indexes translation units and delivers the results
19 // for SymbolsCallback (each slab corresponds to one TU).
21 // Only a subset of SymbolCollector::Options are respected:
22 // - include paths are always collected, and canonicalized appropriately
23 // - references are always counted
24 // - all references are collected (if RefsCallback is non-null)
25 // - the symbol origin is set to Static if not specified by caller
26 std::unique_ptr
<FrontendAction
> createStaticIndexingAction(
27 SymbolCollector::Options Opts
,
28 std::function
<void(SymbolSlab
)> SymbolsCallback
,
29 std::function
<void(RefSlab
)> RefsCallback
,
30 std::function
<void(RelationSlab
)> RelationsCallback
,
31 std::function
<void(IncludeGraph
)> IncludeGraphCallback
);