generate_ast.h 1022 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. #ifndef CARBON_TOOLCHAIN_CHECK_CPP_GENERATE_AST_H_
  5. #define CARBON_TOOLCHAIN_CHECK_CPP_GENERATE_AST_H_
  6. #include "llvm/ADT/ArrayRef.h"
  7. #include "llvm/ADT/IntrusiveRefCntPtr.h"
  8. #include "llvm/Support/VirtualFileSystem.h"
  9. #include "toolchain/check/context.h"
  10. namespace Carbon::Check {
  11. // Generates a Clang AST for the given C++ imports and sets it as the context's
  12. // `cpp_context` and the SemIR's `cpp_file`. Returns a bool that represents
  13. // whether compilation was successful.
  14. auto GenerateAst(Context& context,
  15. llvm::ArrayRef<Parse::Tree::PackagingNames> imports,
  16. llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem> fs,
  17. std::shared_ptr<clang::CompilerInvocation> base_invocation)
  18. -> bool;
  19. } // namespace Carbon::Check
  20. #endif // CARBON_TOOLCHAIN_CHECK_CPP_GENERATE_AST_H_