impl.h 1.3 KB

1234567891011121314151617181920212223242526272829303132333435
  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::Impl& impl) -> void;
  19. // Sets all unset members of the witness for `impl` to the error instruction.
  20. auto FillImplWitnessWithErrors(Context& context, SemIR::Impl& impl) -> void;
  21. // Returns whether the impl is either `final` explicitly, or implicitly due to
  22. // being concrete.
  23. auto IsImplEffectivelyFinal(Context& context, const SemIR::Impl& impl) -> bool;
  24. } // namespace Carbon::Check
  25. #endif // CARBON_TOOLCHAIN_CHECK_IMPL_H_