clang 8.0.0

IndexingAction.h
Go to the documentation of this file.
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 "clang/Lex/Preprocessor.h"
16 #include "llvm/ADT/ArrayRef.h"
17 #include <memory>
18
19 namespace clang {
20 class ASTContext;
21 class ASTReader;
22 class ASTUnit;
23 class Decl;
24 class FrontendAction;
25
26 namespace serialization {
27 class ModuleFile;
28 }
29
30 namespace index {
31 class IndexDataConsumer;
32
33 struct IndexingOptions {
34 enum class SystemSymbolFilterKind {
35 None,
36 DeclarationsOnly,
37 All,
38 };
39
40 SystemSymbolFilterKind SystemSymbolFilter
41 = SystemSymbolFilterKind::DeclarationsOnly;
42 bool IndexFunctionLocals = false;
43 bool IndexImplicitInstantiation = false;
44 // Whether to index macro definitions in the Preprocesor when preprocessor
45 // callback is not available (e.g. after parsing has finished). Note that
46 // macro references are not available in Proprocessor.
47 bool IndexMacrosInPreprocessor = false;
48 };
49
50 /// Creates a frontend action that indexes all symbols (macros and AST decls).
51 /// \param WrappedAction another frontend action to wrap over or null.
52 std::unique_ptr<FrontendAction>
53 createIndexingAction(std::shared_ptr<IndexDataConsumer> DataConsumer,
54 IndexingOptions Opts,
55 std::unique_ptr<FrontendAction> WrappedAction);
56
57 /// Recursively indexes all decls in the AST.
58 void indexASTUnit(ASTUnit &Unit, IndexDataConsumer &DataConsumer,
59 IndexingOptions Opts);
60
61 /// Recursively indexes \p Decls.
62 void indexTopLevelDecls(ASTContext &Ctx, Preprocessor &PP,
63 ArrayRef<const Decl *> Decls,
64 IndexDataConsumer &DataConsumer, IndexingOptions Opts);
65
66 /// Creates a PPCallbacks that indexes macros and feeds macros to \p Consumer.
67 /// The caller is responsible for calling `Consumer.setPreprocessor()`.
68 std::unique_ptr<PPCallbacks> indexMacrosCallback(IndexDataConsumer &Consumer,
69 IndexingOptions Opts);
70
71 /// Recursively indexes all top-level decls in the module.
72 void indexModuleFile(serialization::ModuleFile &Mod, ASTReader &Reader,
73 IndexDataConsumer &DataConsumer, IndexingOptions Opts);
74
75 } // namespace index
76 } // namespace clang
77
78 #endif
clang::index::IndexingOptions
Definition: IndexingAction.h:33
clang::CodeGen::AlignmentSource::Decl
The l-value was an access to a declared entity or something equivalently strong, like the address of ...
clang::index::IndexingOptions::SystemSymbolFilterKind
SystemSymbolFilterKind
Definition: IndexingAction.h:34
clang::ASTContext
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
Definition: ASTContext.h:155
clang::ASTUnit
Utility class for loading a ASTContext from an AST file.
Definition: ASTUnit.h:87
clang::index::indexASTUnit
void indexASTUnit(ASTUnit &Unit, IndexDataConsumer &DataConsumer, IndexingOptions Opts)
Recursively indexes all decls in the AST.
Definition: IndexingAction.cpp:229
clang::index::indexModuleFile
void indexModuleFile(serialization::ModuleFile &Mod, ASTReader &Reader, IndexDataConsumer &DataConsumer, IndexingOptions Opts)
Recursively indexes all top-level decls in the module.
Definition: IndexingAction.cpp:265
LLVM.h
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified...
clang::index::IndexDataConsumer
Definition: IndexDataConsumer.h:27
llvm::ArrayRef
Definition: LLVM.h:32
Preprocessor.h
Defines the clang::Preprocessor interface.
clang::serialization::ModuleFile
Information about a module that has been loaded by the ASTReader.
Definition: Module.h:108
clang
Dataflow Directional Tag Classes.
Definition: CFGReachabilityAnalysis.h:22
clang::ASTReader
Reads an AST files chain containing the contents of a translation unit.
Definition: ASTReader.h:355
clang::index::indexTopLevelDecls
void indexTopLevelDecls(ASTContext &Ctx, Preprocessor &PP, ArrayRef< const Decl *> Decls, IndexDataConsumer &DataConsumer, IndexingOptions Opts)
Recursively indexes Decls.
Definition: IndexingAction.cpp:242
PPCallbacks.h
Defines the PPCallbacks interface.
clang::index::createIndexingAction
std::unique_ptr< FrontendAction > createIndexingAction(std::shared_ptr< IndexDataConsumer > DataConsumer, IndexingOptions Opts, std::unique_ptr< FrontendAction > WrappedAction)
Creates a frontend action that indexes all symbols (macros and AST decls).
Definition: IndexingAction.cpp:200
clang::index::indexMacrosCallback
std::unique_ptr< PPCallbacks > indexMacrosCallback(IndexDataConsumer &Consumer, IndexingOptions Opts)
Creates a PPCallbacks that indexes macros and feeds macros to Consumer.
Definition: IndexingAction.cpp:260
clang::Preprocessor
Engages in a tight little dance with the lexer to efficiently preprocess tokens.
Definition: Preprocessor.h:125