clang API Documentation
00001 //===--- CodeGen/ModuleBuilder.h - Build LLVM from ASTs ---------*- C++ -*-===// 00002 // 00003 // The LLVM Compiler Infrastructure 00004 // 00005 // This file is distributed under the University of Illinois Open Source 00006 // License. See LICENSE.TXT for details. 00007 // 00008 //===----------------------------------------------------------------------===// 00009 // 00010 // This file defines the ModuleBuilder interface. 00011 // 00012 //===----------------------------------------------------------------------===// 00013 00014 #ifndef LLVM_CLANG_CODEGEN_MODULEBUILDER_H 00015 #define LLVM_CLANG_CODEGEN_MODULEBUILDER_H 00016 00017 #include "clang/AST/ASTConsumer.h" 00018 #include <string> 00019 00020 namespace llvm { 00021 class LLVMContext; 00022 class Module; 00023 } 00024 00025 namespace clang { 00026 class DiagnosticsEngine; 00027 class LangOptions; 00028 class CodeGenOptions; 00029 00030 class CodeGenerator : public ASTConsumer { 00031 virtual void anchor(); 00032 public: 00033 virtual llvm::Module* GetModule() = 0; 00034 virtual llvm::Module* ReleaseModule() = 0; 00035 }; 00036 00037 /// CreateLLVMCodeGen - Create a CodeGenerator instance. 00038 /// It is the responsibility of the caller to call delete on 00039 /// the allocated CodeGenerator instance. 00040 CodeGenerator *CreateLLVMCodeGen(DiagnosticsEngine &Diags, 00041 const std::string &ModuleName, 00042 const CodeGenOptions &CGO, 00043 llvm::LLVMContext& C); 00044 } 00045 00046 #endif