specific_interface.h 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  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_SEM_IR_SPECIFIC_INTERFACE_H_
  5. #define CARBON_TOOLCHAIN_SEM_IR_SPECIFIC_INTERFACE_H_
  6. #include "toolchain/base/canonical_value_store.h"
  7. #include "toolchain/sem_ir/ids.h"
  8. namespace Carbon::SemIR {
  9. // A pair of an interface and a specific for that interface.
  10. struct SpecificInterface {
  11. using DiagnosticType = Diagnostics::TypeInfo<std::string>;
  12. static const SpecificInterface None;
  13. InterfaceId interface_id;
  14. SpecificId specific_id;
  15. friend auto operator<<(llvm::raw_ostream& out, SpecificInterface si)
  16. -> llvm::raw_ostream& {
  17. out << "{interface_id: " << si.interface_id
  18. << ", specific_id: " << si.specific_id << "}";
  19. return out;
  20. }
  21. friend auto operator==(const SpecificInterface& lhs,
  22. const SpecificInterface& rhs) -> bool = default;
  23. };
  24. inline constexpr SpecificInterface SpecificInterface::None = {
  25. .interface_id = InterfaceId::None, .specific_id = SpecificId::None};
  26. using SpecificInterfaceStore =
  27. CanonicalValueStore<SpecificInterfaceId, SpecificInterface, Tag<CheckIRId>>;
  28. } // namespace Carbon::SemIR
  29. #endif // CARBON_TOOLCHAIN_SEM_IR_SPECIFIC_INTERFACE_H_