check.h 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637
  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/value_store.h"
  8. #include "toolchain/diagnostics/diagnostic_emitter.h"
  9. #include "toolchain/lex/tokenized_buffer.h"
  10. #include "toolchain/parse/tree.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. SharedValueStores* value_stores;
  17. const Lex::TokenizedBuffer* tokens;
  18. const Parse::Tree* parse_tree;
  19. DiagnosticConsumer* consumer;
  20. // Returns a lazily constructed TreeAndSubtrees.
  21. std::function<const Parse::TreeAndSubtrees&()> get_parse_tree_and_subtrees;
  22. // The generated IR. Unset on input, set on output.
  23. std::optional<SemIR::File>* sem_ir;
  24. };
  25. // Checks a group of parse trees. This will use imports to decide the order of
  26. // checking.
  27. auto CheckParseTrees(llvm::MutableArrayRef<Unit> units, bool prelude_import,
  28. llvm::raw_ostream* vlog_stream) -> void;
  29. } // namespace Carbon::Check
  30. #endif // CARBON_TOOLCHAIN_CHECK_CHECK_H_