File indexing completed on 2026-05-10 08:36:51
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014 #ifndef LLVM_CLANG_CIR_CIRGENERATOR_H
0015 #define LLVM_CLANG_CIR_CIRGENERATOR_H
0016
0017 #include "clang/AST/ASTConsumer.h"
0018 #include "clang/Basic/CodeGenOptions.h"
0019
0020 #include "llvm/ADT/IntrusiveRefCntPtr.h"
0021 #include "llvm/Support/VirtualFileSystem.h"
0022
0023 #include <memory>
0024
0025 namespace clang {
0026 class DeclGroupRef;
0027 class DiagnosticsEngine;
0028 namespace CIRGen {
0029 class CIRGenModule;
0030 }
0031 }
0032
0033 namespace mlir {
0034 class MLIRContext;
0035 }
0036 namespace cir {
0037 class CIRGenerator : public clang::ASTConsumer {
0038 virtual void anchor();
0039 clang::DiagnosticsEngine &diags;
0040 clang::ASTContext *astContext;
0041
0042 llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem> fs;
0043
0044 const clang::CodeGenOptions &codeGenOpts;
0045
0046 protected:
0047 std::unique_ptr<mlir::MLIRContext> mlirContext;
0048 std::unique_ptr<clang::CIRGen::CIRGenModule> cgm;
0049
0050 public:
0051 CIRGenerator(clang::DiagnosticsEngine &diags,
0052 llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem> fs,
0053 const clang::CodeGenOptions &cgo);
0054 ~CIRGenerator() override;
0055 void Initialize(clang::ASTContext &astContext) override;
0056 bool HandleTopLevelDecl(clang::DeclGroupRef group) override;
0057 mlir::ModuleOp getModule() const;
0058 };
0059
0060 }
0061
0062 #endif