ModuleBuilder.cpp 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. //===--- ModuleBuilder.cpp - Emit LLVM Code from ASTs ---------------------===//
  2. //
  3. // The LLVM Compiler Infrastructure
  4. //
  5. // This file was developed by Chris Lattner and is distributed under
  6. // the University of Illinois Open Source License. See LICENSE.TXT for details.
  7. //
  8. //===----------------------------------------------------------------------===//
  9. //
  10. // This builds an AST and converts it to LLVM Code.
  11. //
  12. //===----------------------------------------------------------------------===//
  13. #include "clang/CodeGen/ModuleBuilder.h"
  14. #include "CodeGenModule.h"
  15. using namespace clang;
  16. /// Init - Create an ModuleBuilder with the specified ASTContext.
  17. clang::CodeGen::BuilderTy *
  18. clang::CodeGen::Init(ASTContext &Context, llvm::Module &M) {
  19. return new CodeGenModule(Context, M);
  20. }
  21. void clang::CodeGen::Terminate(BuilderTy *B) {
  22. delete static_cast<CodeGenModule*>(B);
  23. }
  24. /// CodeGenFunction - Convert the AST node for a FunctionDecl into LLVM.
  25. ///
  26. void clang::CodeGen::CodeGenFunction(BuilderTy *B, FunctionDecl *D) {
  27. static_cast<CodeGenModule*>(B)->EmitFunction(D);
  28. }
  29. /// PrintStats - Emit statistic information to stderr.
  30. ///
  31. void clang::CodeGen::PrintStats(BuilderTy *B) {
  32. static_cast<CodeGenModule*>(B)->PrintStats();
  33. }