impl.cpp 777 B

12345678910111213141516171819202122
  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. #include "toolchain/sem_ir/impl.h"
  5. #include "toolchain/sem_ir/file.h"
  6. namespace Carbon::SemIR {
  7. auto ImplStore::GetOrAddLookupBucket(const Impl& impl) -> LookupBucketRef {
  8. auto self_id = sem_ir_.constant_values().GetConstantInstId(impl.self_id);
  9. auto constraint_id =
  10. sem_ir_.constant_values().GetConstantInstId(impl.constraint_id);
  11. return LookupBucketRef(
  12. *this, lookup_
  13. .Insert(std::pair{self_id, constraint_id},
  14. [] { return ImplOrLookupBucketId::Invalid; })
  15. .value());
  16. }
  17. } // namespace Carbon::SemIR