clang 20.0.0git
CIRGenerator.h
Go to the documentation of this file.
1//===- CIRGenerator.h - CIR Generation from Clang AST ---------------------===//
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// This file declares a simple interface to perform CIR generation from Clang
10// AST
11//
12//===----------------------------------------------------------------------===//
13
14#ifndef LLVM_CLANG_CIR_CIRGENERATOR_H
15#define LLVM_CLANG_CIR_CIRGENERATOR_H
16
19
20#include "llvm/ADT/IntrusiveRefCntPtr.h"
21#include "llvm/Support/VirtualFileSystem.h"
22
23#include <memory>
24
25namespace clang {
26class DeclGroupRef;
27class DiagnosticsEngine;
28namespace CIRGen {
29class CIRGenModule;
30} // namespace CIRGen
31} // namespace clang
32
33namespace mlir {
34class MLIRContext;
35} // namespace mlir
36namespace cir {
38 virtual void anchor();
40 clang::ASTContext *astContext;
41 // Only used for debug info.
43
44 const clang::CodeGenOptions &codeGenOpts;
45
46protected:
47 std::unique_ptr<mlir::MLIRContext> mlirContext;
48 std::unique_ptr<clang::CIRGen::CIRGenModule> cgm;
49
50public:
53 const clang::CodeGenOptions &cgo);
54 ~CIRGenerator() override;
55 void Initialize(clang::ASTContext &astContext) override;
56 bool HandleTopLevelDecl(clang::DeclGroupRef group) override;
57 mlir::ModuleOp getModule() const;
58};
59
60} // namespace cir
61
62#endif // LLVM_CLANG_CIR_CIRGENERATOR_H
mlir::ModuleOp getModule() const
std::unique_ptr< clang::CIRGen::CIRGenModule > cgm
Definition: CIRGenerator.h:48
~CIRGenerator() override
bool HandleTopLevelDecl(clang::DeclGroupRef group) override
HandleTopLevelDecl - Handle the specified top-level declaration.
std::unique_ptr< mlir::MLIRContext > mlirContext
Definition: CIRGenerator.h:47
void Initialize(clang::ASTContext &astContext) override
Initialize - This is called to initialize the consumer, providing the ASTContext.
ASTConsumer - This is an abstract interface that should be implemented by clients that read ASTs.
Definition: ASTConsumer.h:34
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
Definition: ASTContext.h:188
This class organizes the cross-function state that is used while generating CIR code.
Definition: CIRGenModule.h:39
CodeGenOptions - Track various options which control how the code is optimized and passed to the back...
Concrete class used by the front-end to report problems and issues.
Definition: Diagnostic.h:231
The JSON file list parser is used to communicate input to InstallAPI.