thunk.h 1.0 KB

123456789101112131415161718192021222324252627
  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_THUNK_H_
  5. #define CARBON_TOOLCHAIN_CHECK_THUNK_H_
  6. #include "toolchain/check/context.h"
  7. #include "toolchain/check/deferred_definition_scope.h"
  8. #include "toolchain/sem_ir/ids.h"
  9. namespace Carbon::Check {
  10. // Given a function signature and a callee function, build a thunk that matches
  11. // the given signature and calls the specified callee. Returns the callee
  12. // unchanged if it can be used directly.
  13. auto BuildThunk(Context& context, SemIR::FunctionId signature_id,
  14. SemIR::SpecificId signature_specific_id,
  15. SemIR::InstId callee_id) -> SemIR::InstId;
  16. // Builds the definition for a thunk whose definition was deferred until the end
  17. // of the enclosing scope.
  18. auto BuildThunkDefinition(Context& context, PendingThunk&& thunk) -> void;
  19. } // namespace Carbon::Check
  20. #endif // CARBON_TOOLCHAIN_CHECK_THUNK_H_