mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-04 22:02:52 +01:00
This helps us move away from the clone-with-modifications approach to thunking, which gets unwieldy as signatures get more complex. --------- Co-authored-by: Richard Smith <richard@metafoo.co.uk>
34 lines
987 B
C++
34 lines
987 B
C++
// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
|
|
// Exceptions. See /LICENSE for license information.
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
|
|
|
#ifndef CARBON_TOOLCHAIN_SEM_IR_THUNK_H_
|
|
#define CARBON_TOOLCHAIN_SEM_IR_THUNK_H_
|
|
|
|
#include "toolchain/base/value_store.h"
|
|
#include "toolchain/sem_ir/ids.h"
|
|
|
|
namespace Carbon::SemIR {
|
|
|
|
// Metadata about a thunk.
|
|
struct ThunkInfo {
|
|
// The callee wrapped by the thunk.
|
|
InstId callee_id;
|
|
|
|
// The signature of the thunk.
|
|
FunctionId signature_id = FunctionId::None;
|
|
|
|
// If `signature_id` is generic, the specific that this thunk is for.
|
|
SpecificId specific_id = SpecificId::None;
|
|
|
|
// If this is a thunk for a virtual function override, the type of the
|
|
// `self` parameter of the override.
|
|
TypeId override_self_type_id = TypeId::None;
|
|
};
|
|
|
|
using ThunkStore = ValueStore<ThunkId, ThunkInfo, Tag<CheckIRId>>;
|
|
|
|
} // namespace Carbon::SemIR
|
|
|
|
#endif // CARBON_TOOLCHAIN_SEM_IR_THUNK_H_
|