generate_ast.h 1.2 KB

123456789101112131415161718192021222324252627282930
  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. // Finishes AST generation for the given checking context. Performs end of file
  20. // steps such as template instantiation and warning on unused declarations.
  21. auto FinishAst(Context& context) -> void;
  22. } // namespace Carbon::Check
  23. #endif // CARBON_TOOLCHAIN_CHECK_CPP_GENERATE_AST_H_