ModuleBuilder.h 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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. #ifndef LLVM_CLANG_CODEGEN_MODULEBUILDER_H
  14. #define LLVM_CLANG_CODEGEN_MODULEBUILDER_H
  15. #include "clang/AST/ASTConsumer.h"
  16. #include <string>
  17. namespace llvm {
  18. class LLVMContext;
  19. class Module;
  20. }
  21. namespace clang {
  22. class DiagnosticsEngine;
  23. class LangOptions;
  24. class CodeGenOptions;
  25. class TargetOptions;
  26. class Decl;
  27. class CodeGenerator : public ASTConsumer {
  28. virtual void anchor();
  29. public:
  30. virtual llvm::Module* GetModule() = 0;
  31. virtual llvm::Module* ReleaseModule() = 0;
  32. virtual const Decl *GetDeclForMangledName(llvm::StringRef MangledName) = 0;
  33. };
  34. /// CreateLLVMCodeGen - Create a CodeGenerator instance.
  35. /// It is the responsibility of the caller to call delete on
  36. /// the allocated CodeGenerator instance.
  37. CodeGenerator *CreateLLVMCodeGen(DiagnosticsEngine &Diags,
  38. const std::string &ModuleName,
  39. const CodeGenOptions &CGO,
  40. const TargetOptions &TO,
  41. llvm::LLVMContext& C);
  42. }
  43. #endif