clang  8.0.0svn
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 
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.
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.
73  IndexDataConsumer &DataConsumer, IndexingOptions Opts);
74 
75 } // namespace index
76 } // namespace clang
77 
78 #endif
The l-value was an access to a declared entity or something equivalently strong, like the address of ...
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
Definition: ASTContext.h:154
Utility class for loading a ASTContext from an AST file.
Definition: ASTUnit.h:87
void indexASTUnit(ASTUnit &Unit, IndexDataConsumer &DataConsumer, IndexingOptions Opts)
Recursively indexes all decls in the AST.
void indexModuleFile(serialization::ModuleFile &Mod, ASTReader &Reader, IndexDataConsumer &DataConsumer, IndexingOptions Opts)
Recursively indexes all top-level decls in the module.
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified...
Defines the clang::Preprocessor interface.
Information about a module that has been loaded by the ASTReader.
Definition: Module.h:108
Dataflow Directional Tag Classes.
Reads an AST files chain containing the contents of a translation unit.
Definition: ASTReader.h:355
void indexTopLevelDecls(ASTContext &Ctx, Preprocessor &PP, ArrayRef< const Decl *> Decls, IndexDataConsumer &DataConsumer, IndexingOptions Opts)
Recursively indexes Decls.
Defines the PPCallbacks interface.
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).
std::unique_ptr< PPCallbacks > indexMacrosCallback(IndexDataConsumer &Consumer, IndexingOptions Opts)
Creates a PPCallbacks that indexes macros and feeds macros to Consumer.
Engages in a tight little dance with the lexer to efficiently preprocess tokens.
Definition: Preprocessor.h:125