]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - include/clang/Index/IndexingAction.h
Vendor import of clang trunk r338150:
[FreeBSD/FreeBSD.git] / include / clang / Index / IndexingAction.h
1 //===--- IndexingAction.h - Frontend index action ---------------*- C++ -*-===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9
10 #ifndef LLVM_CLANG_INDEX_INDEXINGACTION_H
11 #define LLVM_CLANG_INDEX_INDEXINGACTION_H
12
13 #include "clang/Basic/LLVM.h"
14 #include "clang/Lex/PPCallbacks.h"
15 #include "llvm/ADT/ArrayRef.h"
16 #include <memory>
17
18 namespace clang {
19   class ASTContext;
20   class ASTReader;
21   class ASTUnit;
22   class Decl;
23   class FrontendAction;
24
25 namespace serialization {
26   class ModuleFile;
27 }
28
29 namespace index {
30   class IndexDataConsumer;
31
32 struct IndexingOptions {
33   enum class SystemSymbolFilterKind {
34     None,
35     DeclarationsOnly,
36     All,
37   };
38
39   SystemSymbolFilterKind SystemSymbolFilter
40     = SystemSymbolFilterKind::DeclarationsOnly;
41   bool IndexFunctionLocals = false;
42   bool IndexImplicitInstantiation = false;
43 };
44
45 /// Creates a frontend action that indexes all symbols (macros and AST decls).
46 /// \param WrappedAction another frontend action to wrap over or null.
47 std::unique_ptr<FrontendAction>
48 createIndexingAction(std::shared_ptr<IndexDataConsumer> DataConsumer,
49                      IndexingOptions Opts,
50                      std::unique_ptr<FrontendAction> WrappedAction);
51
52 /// Recursively indexes all decls in the AST.
53 /// Note that this does not index macros.
54 void indexASTUnit(ASTUnit &Unit, IndexDataConsumer &DataConsumer,
55                   IndexingOptions Opts);
56
57 /// Recursively indexes \p Decls.
58 /// Note that this does not index macros.
59 void indexTopLevelDecls(ASTContext &Ctx, ArrayRef<const Decl *> Decls,
60                         IndexDataConsumer &DataConsumer, IndexingOptions Opts);
61
62 /// Creates a PPCallbacks that indexes macros and feeds macros to \p Consumer.
63 /// The caller is responsible for calling `Consumer.setPreprocessor()`.
64 std::unique_ptr<PPCallbacks> indexMacrosCallback(IndexDataConsumer &Consumer,
65                                                  IndexingOptions Opts);
66
67 /// Recursively indexes all top-level decls in the module.
68 /// FIXME: make this index macros as well.
69 void indexModuleFile(serialization::ModuleFile &Mod, ASTReader &Reader,
70                      IndexDataConsumer &DataConsumer, IndexingOptions Opts);
71
72 } // namespace index
73 } // namespace clang
74
75 #endif