check.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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/sem_ir_diagnostic_converter.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. DiagnosticConsumer* consumer;
  17. SharedValueStores* value_stores;
  18. // The `timings` may be null if nothing is to be recorded.
  19. Timings* timings;
  20. // Returns a lazily constructed TreeAndSubtrees.
  21. Parse::GetTreeAndSubtreesFn get_parse_tree_and_subtrees;
  22. // The unit's SemIR, provided as empty and filled in by CheckParseTrees.
  23. SemIR::File* sem_ir;
  24. // Diagnostic converters.
  25. SemIRDiagnosticConverter* sem_ir_converter;
  26. };
  27. // Checks a group of parse trees. This will use imports to decide the order of
  28. // checking.
  29. auto CheckParseTrees(llvm::MutableArrayRef<Unit> units, bool prelude_import,
  30. 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_