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