check.h 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  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. All members are caller-owned.
  15. // Other than `timings`, members must be non-null.
  16. struct Unit {
  17. Diagnostics::Consumer* consumer;
  18. SharedValueStores* value_stores;
  19. // The `timings` may be null if nothing is to be recorded.
  20. Timings* timings;
  21. // The unit's SemIR, provided as empty and filled in by CheckParseTrees.
  22. SemIR::File* sem_ir;
  23. // Storage for the unit's Clang AST. The unique_ptr should start empty, and
  24. // can be assigned as part of checking.
  25. std::unique_ptr<clang::ASTUnit>* cpp_ast;
  26. };
  27. // Checks a group of parse trees. This will use imports to decide the order of
  28. // checking.
  29. auto CheckParseTrees(
  30. llvm::MutableArrayRef<Unit> units,
  31. llvm::ArrayRef<Parse::GetTreeAndSubtreesFn> tree_and_subtrees_getters,
  32. bool prelude_import, llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem> fs,
  33. llvm::StringRef target, llvm::raw_ostream* vlog_stream, bool fuzzing)
  34. -> void;
  35. } // namespace Carbon::Check
  36. #endif // CARBON_TOOLCHAIN_CHECK_CHECK_H_