impl.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  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_IMPL_H_
  5. #define CARBON_TOOLCHAIN_CHECK_IMPL_H_
  6. #include "toolchain/check/context.h"
  7. #include "toolchain/sem_ir/ids.h"
  8. namespace Carbon::Check {
  9. // Returns the initial witness value for a new `impl` declaration.
  10. //
  11. // `has_definition` is whether this declaration is immediately followed by the
  12. // opening of the definition.
  13. auto ImplWitnessForDeclaration(Context& context, const SemIR::Impl& impl,
  14. bool has_definition) -> SemIR::InstId;
  15. // Update `impl`'s witness at the start of a definition.
  16. auto ImplWitnessStartDefinition(Context& context, SemIR::Impl& impl) -> void;
  17. // Adds the function members to the witness for `impl`.
  18. auto FinishImplWitness(Context& context, SemIR::ImplId impl_id) -> void;
  19. // Sets all unset members of the witness for `impl` to the error instruction and
  20. // sets the witness id in the `Impl` to an error.
  21. auto FillImplWitnessWithErrors(Context& context, SemIR::Impl& impl) -> void;
  22. // Sets the `ImplId` in the `ImplWitnessTable`.
  23. auto AssignImplIdInWitness(Context& context, SemIR::ImplId impl_id,
  24. SemIR::InstId witness_id) -> void;
  25. // Returns whether the impl is either `final` explicitly, or implicitly due to
  26. // being concrete.
  27. auto IsImplEffectivelyFinal(Context& context, const SemIR::Impl& impl) -> bool;
  28. } // namespace Carbon::Check
  29. #endif // CARBON_TOOLCHAIN_CHECK_IMPL_H_