clang API Documentation

ModuleBuilder.h
Go to the documentation of this file.
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 CoverageSourceInfo;
00028   class LangOptions;
00029   class CodeGenOptions;
00030   class TargetOptions;
00031   class Decl;
00032 
00033   class CodeGenerator : public ASTConsumer {
00034     virtual void anchor();
00035   public:
00036     virtual llvm::Module* GetModule() = 0;
00037     virtual llvm::Module* ReleaseModule() = 0;
00038     virtual const Decl *GetDeclForMangledName(llvm::StringRef MangledName) = 0;
00039   };
00040 
00041   /// CreateLLVMCodeGen - Create a CodeGenerator instance.
00042   /// It is the responsibility of the caller to call delete on
00043   /// the allocated CodeGenerator instance.
00044   CodeGenerator *CreateLLVMCodeGen(DiagnosticsEngine &Diags,
00045                                    const std::string &ModuleName,
00046                                    const CodeGenOptions &CGO,
00047                                    const TargetOptions &TO,
00048                                    llvm::LLVMContext& C,
00049                                    CoverageSourceInfo *CoverageInfo = nullptr);
00050 }
00051 
00052 #endif