check.h 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  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_CHECK_H_
  5. #define CARBON_TOOLCHAIN_CHECK_CHECK_H_
  6. #include "common/ostream.h"
  7. #include "toolchain/base/shared_value_stores.h"
  8. #include "toolchain/base/timings.h"
  9. #include "toolchain/check/diagnostic_emitter.h"
  10. #include "toolchain/diagnostics/diagnostic_emitter.h"
  11. #include "toolchain/parse/tree_and_subtrees.h"
  12. #include "toolchain/sem_ir/file.h"
  13. namespace Carbon::Check {
  14. // Checking information that's tracked per file.
  15. struct Unit {
  16. Diagnostics::Consumer* consumer;
  17. SharedValueStores* value_stores;
  18. // The `timings` may be null if nothing is to be recorded.
  19. Timings* timings;
  20. // The unit's SemIR, provided as empty and filled in by CheckParseTrees.
  21. SemIR::File* sem_ir;
  22. // The Clang AST owned by `CompileSubcommand`.
  23. std::unique_ptr<clang::ASTUnit>* cpp_ast = nullptr;
  24. };
  25. // Checks a group of parse trees. This will use imports to decide the order of
  26. // checking.
  27. auto CheckParseTrees(
  28. llvm::MutableArrayRef<Unit> units,
  29. llvm::ArrayRef<Parse::GetTreeAndSubtreesFn> tree_and_subtrees_getters,
  30. bool prelude_import, llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem> fs,
  31. llvm::raw_ostream* vlog_stream, bool fuzzing) -> void;
  32. } // namespace Carbon::Check
  33. #endif // CARBON_TOOLCHAIN_CHECK_CHECK_H_