• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //===--- IndexAction.h - Run the indexer as a frontend action ----*- C++-*-===//
2 //
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
6 //
7 //===----------------------------------------------------------------------===//
8 
9 #ifndef LLVM_CLANG_TOOLS_EXTRA_CLANGD_INDEX_INDEX_ACTION_H
10 #define LLVM_CLANG_TOOLS_EXTRA_CLANGD_INDEX_INDEX_ACTION_H
11 #include "Headers.h"
12 #include "SymbolCollector.h"
13 #include "clang/Frontend/FrontendActions.h"
14 
15 namespace clang {
16 namespace clangd {
17 
18 // Creates an action that indexes translation units and delivers the results
19 // for SymbolsCallback (each slab corresponds to one TU).
20 //
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);
32 
33 } // namespace clangd
34 } // namespace clang
35 
36 #endif
37