ModuleBuilder.h revision 234353
1193326Sed//===--- CodeGen/ModuleBuilder.h - Build LLVM from ASTs ---------*- C++ -*-===//
2193326Sed//
3193326Sed//                     The LLVM Compiler Infrastructure
4193326Sed//
5193326Sed// This file is distributed under the University of Illinois Open Source
6193326Sed// License. See LICENSE.TXT for details.
7193326Sed//
8193326Sed//===----------------------------------------------------------------------===//
9193326Sed//
10193326Sed//  This file defines the ModuleBuilder interface.
11193326Sed//
12193326Sed//===----------------------------------------------------------------------===//
13193326Sed
14193326Sed#ifndef LLVM_CLANG_CODEGEN_MODULEBUILDER_H
15193326Sed#define LLVM_CLANG_CODEGEN_MODULEBUILDER_H
16193326Sed
17193326Sed#include "clang/AST/ASTConsumer.h"
18193326Sed#include <string>
19193326Sed
20193326Sednamespace llvm {
21195341Sed  class LLVMContext;
22193326Sed  class Module;
23193326Sed}
24193326Sed
25193326Sednamespace clang {
26226633Sdim  class DiagnosticsEngine;
27193326Sed  class LangOptions;
28199482Srdivacky  class CodeGenOptions;
29198092Srdivacky
30193326Sed  class CodeGenerator : public ASTConsumer {
31234353Sdim    virtual void anchor();
32193326Sed  public:
33193326Sed    virtual llvm::Module* GetModule() = 0;
34198092Srdivacky    virtual llvm::Module* ReleaseModule() = 0;
35193326Sed  };
36198092Srdivacky
37210299Sed  /// CreateLLVMCodeGen - Create a CodeGenerator instance.
38210299Sed  /// It is the responsibility of the caller to call delete on
39210299Sed  /// the allocated CodeGenerator instance.
40226633Sdim  CodeGenerator *CreateLLVMCodeGen(DiagnosticsEngine &Diags,
41193326Sed                                   const std::string &ModuleName,
42199482Srdivacky                                   const CodeGenOptions &CGO,
43195341Sed                                   llvm::LLVMContext& C);
44193326Sed}
45193326Sed
46193326Sed#endif
47