Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-10 08:36:56

0001 //===--- IndexingAction.h - Frontend index action ---------------*- C++ -*-===//
0002 //
0003 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
0004 // See https://llvm.org/LICENSE.txt for license information.
0005 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
0006 //
0007 //===----------------------------------------------------------------------===//
0008 
0009 #ifndef LLVM_CLANG_INDEX_INDEXINGACTION_H
0010 #define LLVM_CLANG_INDEX_INDEXINGACTION_H
0011 
0012 #include "clang/AST/ASTConsumer.h"
0013 #include "clang/Basic/LLVM.h"
0014 #include "clang/Index/IndexingOptions.h"
0015 #include "clang/Lex/PPCallbacks.h"
0016 #include "clang/Lex/Preprocessor.h"
0017 #include "llvm/ADT/ArrayRef.h"
0018 #include <memory>
0019 
0020 namespace clang {
0021   class ASTContext;
0022   class ASTConsumer;
0023   class ASTReader;
0024   class ASTUnit;
0025   class Decl;
0026   class FrontendAction;
0027 
0028 namespace serialization {
0029   class ModuleFile;
0030 }
0031 
0032 namespace index {
0033 class IndexDataConsumer;
0034 
0035 /// Creates an ASTConsumer that indexes all symbols (macros and AST decls).
0036 std::unique_ptr<ASTConsumer>
0037 createIndexingASTConsumer(std::shared_ptr<IndexDataConsumer> DataConsumer,
0038                           const IndexingOptions &Opts,
0039                           std::shared_ptr<Preprocessor> PP);
0040 
0041 std::unique_ptr<ASTConsumer> createIndexingASTConsumer(
0042     std::shared_ptr<IndexDataConsumer> DataConsumer,
0043     const IndexingOptions &Opts, std::shared_ptr<Preprocessor> PP,
0044     // Prefer to set Opts.ShouldTraverseDecl and use the above overload.
0045     // This version is only needed if used to *track* function body parsing.
0046     std::function<bool(const Decl *)> ShouldSkipFunctionBody);
0047 
0048 /// Creates a frontend action that indexes all symbols (macros and AST decls).
0049 std::unique_ptr<FrontendAction>
0050 createIndexingAction(std::shared_ptr<IndexDataConsumer> DataConsumer,
0051                      const IndexingOptions &Opts);
0052 
0053 /// Recursively indexes all decls in the AST.
0054 void indexASTUnit(ASTUnit &Unit, IndexDataConsumer &DataConsumer,
0055                   IndexingOptions Opts);
0056 
0057 /// Recursively indexes \p Decls.
0058 void indexTopLevelDecls(ASTContext &Ctx, Preprocessor &PP,
0059                         ArrayRef<const Decl *> Decls,
0060                         IndexDataConsumer &DataConsumer, IndexingOptions Opts);
0061 
0062 /// Creates a PPCallbacks that indexes macros and feeds macros to \p Consumer.
0063 /// The caller is responsible for calling `Consumer.setPreprocessor()`.
0064 std::unique_ptr<PPCallbacks> indexMacrosCallback(IndexDataConsumer &Consumer,
0065                                                  IndexingOptions Opts);
0066 
0067 /// Recursively indexes all top-level decls in the module.
0068 void indexModuleFile(serialization::ModuleFile &Mod, ASTReader &Reader,
0069                      IndexDataConsumer &DataConsumer, IndexingOptions Opts);
0070 
0071 } // namespace index
0072 } // namespace clang
0073 
0074 #endif