File indexing completed on 2026-05-10 08:36:51
0001
0002
0003
0004
0005
0006
0007
0008
0009 #ifndef LLVM_CLANG_CIR_CIRGENACTION_H
0010 #define LLVM_CLANG_CIR_CIRGENACTION_H
0011
0012 #include "clang/Frontend/FrontendAction.h"
0013
0014 #include "mlir/IR/BuiltinOps.h"
0015 #include "mlir/IR/OwningOpRef.h"
0016
0017 namespace mlir {
0018 class MLIRContext;
0019 class ModuleOp;
0020 }
0021
0022 namespace cir {
0023 class CIRGenConsumer;
0024
0025 class CIRGenAction : public clang::ASTFrontendAction {
0026 public:
0027 enum class OutputType {
0028 EmitCIR,
0029 };
0030
0031 private:
0032 friend class CIRGenConsumer;
0033
0034 mlir::OwningOpRef<mlir::ModuleOp> MLIRMod;
0035
0036 mlir::MLIRContext *MLIRCtx;
0037
0038 protected:
0039 CIRGenAction(OutputType Action, mlir::MLIRContext *MLIRCtx = nullptr);
0040
0041 std::unique_ptr<clang::ASTConsumer>
0042 CreateASTConsumer(clang::CompilerInstance &CI,
0043 llvm::StringRef InFile) override;
0044
0045 public:
0046 ~CIRGenAction() override;
0047
0048 OutputType Action;
0049 };
0050
0051 class EmitCIRAction : public CIRGenAction {
0052 virtual void anchor();
0053
0054 public:
0055 EmitCIRAction(mlir::MLIRContext *MLIRCtx = nullptr);
0056 };
0057
0058 }
0059
0060 #endif