mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 22:02:55 +01:00
Add BuildSelfDestructCall (#7824)
The toolchain builds `<object>.(Destroy.SelfDestruct)()` in a few different places. This function keeps things consistent across call sites.
This commit is contained in:
@@ -8,6 +8,7 @@
|
||||
|
||||
#include "toolchain/check/call.h"
|
||||
#include "toolchain/check/context.h"
|
||||
#include "toolchain/check/convert.h"
|
||||
#include "toolchain/check/cpp/call.h"
|
||||
#include "toolchain/check/cpp/operators.h"
|
||||
#include "toolchain/check/generic.h"
|
||||
@@ -102,6 +103,14 @@ auto BuildUnaryOperator(Context& context, SemIR::LocId loc_id, Operator op,
|
||||
/*is_desugared=*/true);
|
||||
}
|
||||
|
||||
auto BuildSelfDestructCall(Context& context, SemIR::LocId loc_id,
|
||||
SemIR::InstId object_id) -> SemIR::InstId {
|
||||
return BuildUnaryOperator(context, loc_id,
|
||||
{.interface_name = CoreIdentifier::Destroy,
|
||||
.op_name = CoreIdentifier::SelfDestruct},
|
||||
object_id);
|
||||
}
|
||||
|
||||
auto BuildBinaryOperator(Context& context, SemIR::LocId loc_id, Operator op,
|
||||
SemIR::InstId lhs_id, SemIR::InstId rhs_id,
|
||||
bool diagnose,
|
||||
|
||||
Reference in New Issue
Block a user