clang  9.0.0svn
IndexingAction.h
Go to the documentation of this file.
1 //===--- IndexingAction.h - Frontend index 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_INDEX_INDEXINGACTION_H
10 #define LLVM_CLANG_INDEX_INDEXINGACTION_H
11 
12 #include "clang/Basic/LLVM.h"
13 #include "clang/Lex/PPCallbacks.h"
14 #include "clang/Lex/Preprocessor.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 
34  None,
35  DeclarationsOnly,
36  All,
37  };
38 
39  SystemSymbolFilterKind SystemSymbolFilter
40  = SystemSymbolFilterKind::DeclarationsOnly;
41  bool IndexFunctionLocals = false;
42  bool IndexImplicitInstantiation = false;
43  // Whether to index macro definitions in the Preprocesor when preprocessor
44  // callback is not available (e.g. after parsing has finished). Note that
45  // macro references are not available in Proprocessor.
46  bool IndexMacrosInPreprocessor = false;
47  // Has no effect if IndexFunctionLocals are false.
48  bool IndexParametersInDeclarations = false;
49  bool IndexTemplateParameters = false;
50 };
51 
52 /// Creates a frontend action that indexes all symbols (macros and AST decls).
53 /// \param WrappedAction another frontend action to wrap over or null.
54 std::unique_ptr<FrontendAction>
55 createIndexingAction(std::shared_ptr<IndexDataConsumer> DataConsumer,
56  IndexingOptions Opts,
57  std::unique_ptr<FrontendAction> WrappedAction);
58 
59 /// Recursively indexes all decls in the AST.
60 void indexASTUnit(ASTUnit &Unit, IndexDataConsumer &DataConsumer,
61  IndexingOptions Opts);
62 
63 /// Recursively indexes \p Decls.
66  IndexDataConsumer &DataConsumer, IndexingOptions Opts);
67 
68 /// Creates a PPCallbacks that indexes macros and feeds macros to \p Consumer.
69 /// The caller is responsible for calling `Consumer.setPreprocessor()`.
70 std::unique_ptr<PPCallbacks> indexMacrosCallback(IndexDataConsumer &Consumer,
71  IndexingOptions Opts);
72 
73 /// Recursively indexes all top-level decls in the module.
75  IndexDataConsumer &DataConsumer, IndexingOptions Opts);
76 
77 } // namespace index
78 } // namespace clang
79 
80 #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:86
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:107
Dataflow Directional Tag Classes.
Reads an AST files chain containing the contents of a translation unit.
Definition: ASTReader.h:354
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:124