clang 20.0.0git
Frontend.h
Go to the documentation of this file.
1//===- InstallAPI/Frontend.h -----------------------------------*- 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/// Top level wrappers for InstallAPI frontend operations.
10///
11//===----------------------------------------------------------------------===//
12
13#ifndef LLVM_CLANG_INSTALLAPI_FRONTEND_H
14#define LLVM_CLANG_INSTALLAPI_FRONTEND_H
15
22#include "llvm/ADT/Twine.h"
23#include "llvm/Support/MemoryBuffer.h"
24
25namespace clang {
26namespace installapi {
27
28/// Create a buffer that contains all headers to scan
29/// for global symbols with.
30std::unique_ptr<llvm::MemoryBuffer> createInputBuffer(InstallAPIContext &Ctx);
31
33public:
34 explicit InstallAPIAction(InstallAPIContext &Ctx) : Ctx(Ctx) {}
35
36 std::unique_ptr<ASTConsumer> CreateASTConsumer(CompilerInstance &CI,
37 StringRef InFile) override {
39 Ctx.Verifier->setSourceManager(CI.getSourceManagerPtr());
40 return std::make_unique<InstallAPIVisitor>(
41 CI.getASTContext(), Ctx, CI.getSourceManager(), CI.getPreprocessor());
42 }
43
44private:
46};
47} // namespace installapi
48} // namespace clang
49
50#endif // LLVM_CLANG_INSTALLAPI_FRONTEND_H
Abstract base class to use for AST consumer-based frontend actions.
CompilerInstance - Helper class for managing a single instance of the Clang compiler.
Preprocessor & getPreprocessor() const
Return the current preprocessor.
ASTContext & getASTContext() const
LangOptions & getLangOpts()
SourceManager & getSourceManager() const
Return the current source manager.
IntrusiveRefCntPtr< SourceManager > getSourceManagerPtr() const
virtual void BeginSourceFile(const LangOptions &LangOpts, const Preprocessor *PP=nullptr)
Callback to inform the diagnostic client that processing of a source file is beginning.
Definition: Diagnostic.h:1769
DiagnosticConsumer * getClient()
Definition: Diagnostic.h:572
std::unique_ptr< ASTConsumer > CreateASTConsumer(CompilerInstance &CI, StringRef InFile) override
Create the AST consumer object for this action, if supported.
Definition: Frontend.h:36
InstallAPIAction(InstallAPIContext &Ctx)
Definition: Frontend.h:34
std::unique_ptr< llvm::MemoryBuffer > createInputBuffer(InstallAPIContext &Ctx)
Create a buffer that contains all headers to scan for global symbols with.
Definition: Frontend.cpp:136
The JSON file list parser is used to communicate input to InstallAPI.
Struct used for generating validating InstallAPI.
Definition: Context.h:26
std::unique_ptr< DylibVerifier > Verifier
Verifier when binary dylib is passed as input.
Definition: Context.h:53
DiagnosticsEngine * Diags
DiagnosticsEngine for all error reporting.
Definition: Context.h:50