class.h 1.3 KB

1234567891011121314151617181920212223242526272829303132
  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_CLASS_H_
  5. #define CARBON_TOOLCHAIN_CHECK_CLASS_H_
  6. #include "toolchain/check/context.h"
  7. namespace Carbon::Check {
  8. // If `type_id` is a class type, get its corresponding `SemIR::Class` object.
  9. // Otherwise returns `nullptr`.
  10. auto TryGetAsClass(Context& context, SemIR::TypeId type_id) -> SemIR::Class*;
  11. // Sets the `Self` type for the class.
  12. auto SetClassSelfType(Context& context, SemIR::ClassId class_id) -> void;
  13. // Starts the class definition, adding `Self` to name lookup.
  14. auto StartClassDefinition(Context& context, SemIR::Class& class_info,
  15. SemIR::InstId definition_id) -> void;
  16. // Computes the object representation for a fully defined class.
  17. auto ComputeClassObjectRepr(Context& context, Parse::ClassDefinitionId node_id,
  18. SemIR::ClassId class_id,
  19. llvm::ArrayRef<SemIR::InstId> field_decls,
  20. llvm::ArrayRef<SemIR::InstId> vtable_contents,
  21. llvm::ArrayRef<SemIR::InstId> body) -> void;
  22. } // namespace Carbon::Check
  23. #endif // CARBON_TOOLCHAIN_CHECK_CLASS_H_