1 //===--- CodeGen/ModuleBuilder.h - Build LLVM from ASTs ---------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file defines the ModuleBuilder interface.
12 //===----------------------------------------------------------------------===//
14 #ifndef LLVM_CLANG_CODEGEN_MODULEBUILDER_H
15 #define LLVM_CLANG_CODEGEN_MODULEBUILDER_H
17 #include "clang/AST/ASTConsumer.h"
26 class DiagnosticsEngine;
30 class CodeGenerator : public ASTConsumer {
31 virtual void anchor();
33 virtual llvm::Module* GetModule() = 0;
34 virtual llvm::Module* ReleaseModule() = 0;
37 /// CreateLLVMCodeGen - Create a CodeGenerator instance.
38 /// It is the responsibility of the caller to call delete on
39 /// the allocated CodeGenerator instance.
40 CodeGenerator *CreateLLVMCodeGen(DiagnosticsEngine &Diags,
41 const std::string &ModuleName,
42 const CodeGenOptions &CGO,
43 llvm::LLVMContext& C);