import_ref.h 1.3 KB

123456789101112131415161718192021222324252627282930313233343536
  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_IMPORT_REF_H_
  5. #define CARBON_TOOLCHAIN_CHECK_IMPORT_REF_H_
  6. #include "toolchain/check/context.h"
  7. #include "toolchain/sem_ir/file.h"
  8. #include "toolchain/sem_ir/ids.h"
  9. namespace Carbon::Check {
  10. // Sets the IR for ImportIRId::ApiForImpl. Should be called before AddImportIR
  11. // in order to ensure the correct ID is assigned.
  12. auto SetApiImportIR(Context& context, SemIR::ImportIR import_ir) -> void;
  13. // Adds an ImportIR, returning the ID. May use an existing ID if already added.
  14. auto AddImportIR(Context& context, SemIR::ImportIR import_ir)
  15. -> SemIR::ImportIRId;
  16. // Adds an import_ref instruction for the specified instruction in the
  17. // specified IR. The import_ref is initially marked as unused.
  18. auto AddImportRef(Context& context, SemIR::ImportIRInst import_ir_inst)
  19. -> SemIR::InstId;
  20. // If the passed in instruction ID is an ImportRefUnloaded, turns it into an
  21. // ImportRefLoaded for use.
  22. auto LoadImportRef(Context& context, SemIR::InstId inst_id) -> void;
  23. // Load all impls declared in IRs imported into this context.
  24. auto ImportImpls(Context& context) -> void;
  25. } // namespace Carbon::Check
  26. #endif // CARBON_TOOLCHAIN_CHECK_IMPORT_REF_H_