1//===--- CodeGen/ModuleBuilder.h - Build LLVM from ASTs ---------*- C++ -*-===// 2// 3// The LLVM Compiler Infrastructure 4// 5// This file is distributed under the University of Illinois Open Source 6// License. See LICENSE.TXT for details. 7// 8//===----------------------------------------------------------------------===// 9// 10// This file defines the ModuleBuilder interface. 11// 12//===----------------------------------------------------------------------===// 13 14#ifndef LLVM_CLANG_CODEGEN_MODULEBUILDER_H 15#define LLVM_CLANG_CODEGEN_MODULEBUILDER_H 16 17#include "clang/AST/ASTConsumer.h" 18#include <string> 19 20namespace llvm { 21 class LLVMContext; 22 class Module; 23} 24 25namespace clang { 26 class DiagnosticsEngine; 27 class LangOptions; 28 class CodeGenOptions; 29 class TargetOptions; 30 class Decl; 31 32 class CodeGenerator : public ASTConsumer { 33 virtual void anchor(); 34 public: 35 virtual llvm::Module* GetModule() = 0; 36 virtual llvm::Module* ReleaseModule() = 0; 37 virtual const Decl *GetDeclForMangledName(llvm::StringRef MangledName) = 0; 38 }; 39 40 /// CreateLLVMCodeGen - Create a CodeGenerator instance. 41 /// It is the responsibility of the caller to call delete on 42 /// the allocated CodeGenerator instance. 43 CodeGenerator *CreateLLVMCodeGen(DiagnosticsEngine &Diags, 44 const std::string &ModuleName, 45 const CodeGenOptions &CGO, 46 const TargetOptions &TO, 47 llvm::LLVMContext& C); 48} 49 50#endif 51