lower.cpp 979 B

1234567891011121314151617181920212223242526
  1. // Part of the Carbon Language project, under the Apache License v2.0 with LLVM
  2. // Exceptions. See /LICENSE for license information.
  3. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  4. #include "toolchain/lower/lower.h"
  5. #include <memory>
  6. #include <optional>
  7. #include "toolchain/lower/file_context.h"
  8. namespace Carbon::Lower {
  9. auto LowerToLLVM(llvm::LLVMContext& llvm_context,
  10. std::optional<llvm::ArrayRef<Parse::GetTreeAndSubtreesFn>>
  11. tree_and_subtrees_getters_for_debug_info,
  12. llvm::StringRef module_name, const SemIR::File& sem_ir,
  13. clang::ASTUnit* cpp_ast, const SemIR::InstNamer* inst_namer,
  14. llvm::raw_ostream* vlog_stream)
  15. -> std::unique_ptr<llvm::Module> {
  16. FileContext context(llvm_context, tree_and_subtrees_getters_for_debug_info,
  17. module_name, sem_ir, cpp_ast, inst_namer, vlog_stream);
  18. return context.Run();
  19. }
  20. } // namespace Carbon::Lower