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 "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 };
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.
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.
70  IndexDataConsumer &DataConsumer, IndexingOptions Opts);
71 
72 } // namespace index
73 } // namespace clang
74 
75 #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:153
Utility class for loading a ASTContext from an AST file.
Definition: ASTUnit.h:88
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...
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:354
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).
void indexTopLevelDecls(ASTContext &Ctx, ArrayRef< const Decl *> Decls, IndexDataConsumer &DataConsumer, IndexingOptions Opts)
Recursively indexes Decls.
std::unique_ptr< PPCallbacks > indexMacrosCallback(IndexDataConsumer &Consumer, IndexingOptions Opts)
Creates a PPCallbacks that indexes macros and feeds macros to Consumer.