lower.cpp 1.1 KB

12345678910111213141516171819202122232425262728
  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. llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem> fs,
  11. std::optional<llvm::ArrayRef<Parse::GetTreeAndSubtreesFn>>
  12. tree_and_subtrees_getters_for_debug_info,
  13. llvm::StringRef module_name, const SemIR::File& sem_ir,
  14. clang::ASTUnit* cpp_ast, const SemIR::InstNamer* inst_namer,
  15. llvm::raw_ostream* vlog_stream)
  16. -> std::unique_ptr<llvm::Module> {
  17. FileContext context(llvm_context, std::move(fs),
  18. tree_and_subtrees_getters_for_debug_info, module_name,
  19. sem_ir, cpp_ast, inst_namer, vlog_stream);
  20. return context.Run();
  21. }
  22. } // namespace Carbon::Lower