Files
carbon-lang/toolchain/check/core_identifier.def
T
Christopher Di Bella 05a7ecbd34 Move SubobjectDestroy and SelfDestruct out of interface Destroy (#7942)
Determining that a type has trivial destruction requires checking
whether all of its subobjects have trivial destruction and whether its
type has a custom witness for `Destroy.Op`. This isn't possible when
`Destroy` is the custodian for `Destroy.Op` and `SubobjectDestroy.Op`,
so we need to make `SubobjectDestroy` its own interface.

`Destroy.SelfDestruct` becomes a standalone function because it depends
on `SubobjectDestroy` and `Destroy` being implemented, and is also
responsible for generating any custom witnesses for both interfaces.
Making `SelfDestruct` an interface was experimented with, but this
required a blanket impl that caused issues for facet types.

`Destroy` depends on `SubobjectDestroy` to be implemented. We'd ideally
use `require impls SubobjectDestroy`, but it isn't complete yet, and it
also causes problems when `Destroy` is implemented inside the class
definition. We work around this by temporarily renaming the `Destroy`
interface to `DestroyImpl`, and introducing a constraint called
`Destroy` so that user code doesn't need to write `Core.SubobjectDestroy
& Core.Destroy`.
2026-10-26 21:35:01 +00:00

95 lines
3.2 KiB
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
//
// This is an X-macro header. It does not use `#include` guards, and instead is
// designed to be `#include`ed after the x-macro is defined in order for its
// inclusion to expand to the desired output. Macro definitions are cleaned up
// at the end of this file.
//
// This macro should be defined before including this header:
// - CARBON_CORE_IDENTIFIER(Name)
// Invoked for each `Core` identifier.
#ifndef CARBON_CORE_IDENTIFIER
#error "Must define the x-macro to use this file."
#define CARBON_CORE_IDENTIFIER(Name)
#endif
CARBON_CORE_IDENTIFIER(AddAssignWith)
CARBON_CORE_IDENTIFIER(AddWith)
CARBON_CORE_IDENTIFIER(Array)
CARBON_CORE_IDENTIFIER(As)
CARBON_CORE_IDENTIFIER(AssignWith)
CARBON_CORE_IDENTIFIER(At)
CARBON_CORE_IDENTIFIER(BitAndAssignWith)
CARBON_CORE_IDENTIFIER(BitAndWith)
CARBON_CORE_IDENTIFIER(BitComplement)
CARBON_CORE_IDENTIFIER(BitOrAssignWith)
CARBON_CORE_IDENTIFIER(BitOrWith)
CARBON_CORE_IDENTIFIER(BitXorAssignWith)
CARBON_CORE_IDENTIFIER(BitXorWith)
CARBON_CORE_IDENTIFIER(Bool)
CARBON_CORE_IDENTIFIER(Char)
CARBON_CORE_IDENTIFIER(Convert)
CARBON_CORE_IDENTIFIER(Copy)
CARBON_CORE_IDENTIFIER(CppCompat)
CARBON_CORE_IDENTIFIER(CppRangeForIterate)
CARBON_CORE_IDENTIFIER(CppUnsafeDeref)
CARBON_CORE_IDENTIFIER(Dec)
CARBON_CORE_IDENTIFIER(Default)
CARBON_CORE_IDENTIFIER(DefaultOrUnformed)
CARBON_CORE_IDENTIFIER(DestroyImpl)
CARBON_CORE_IDENTIFIER(DivAssignWith)
CARBON_CORE_IDENTIFIER(DivWith)
CARBON_CORE_IDENTIFIER(EqWith)
CARBON_CORE_IDENTIFIER(Equal)
CARBON_CORE_IDENTIFIER(Float)
CARBON_CORE_IDENTIFIER(FloatFitsIn)
CARBON_CORE_IDENTIFIER(Get)
CARBON_CORE_IDENTIFIER(Greater)
CARBON_CORE_IDENTIFIER(GreaterOrEquivalent)
CARBON_CORE_IDENTIFIER(HasValue)
CARBON_CORE_IDENTIFIER(ImplicitAs)
CARBON_CORE_IDENTIFIER(Inc)
CARBON_CORE_IDENTIFIER(IndexWith)
CARBON_CORE_IDENTIFIER(IndirectIndexWith)
CARBON_CORE_IDENTIFIER(Int)
CARBON_CORE_IDENTIFIER(IntFitsIn)
CARBON_CORE_IDENTIFIER(Iterate)
CARBON_CORE_IDENTIFIER(LeftShiftAssignWith)
CARBON_CORE_IDENTIFIER(LeftShiftWith)
CARBON_CORE_IDENTIFIER(Less)
CARBON_CORE_IDENTIFIER(LessOrEquivalent)
CARBON_CORE_IDENTIFIER(Long32)
CARBON_CORE_IDENTIFIER(Long64)
CARBON_CORE_IDENTIFIER(LongLong64)
CARBON_CORE_IDENTIFIER(ModAssignWith)
CARBON_CORE_IDENTIFIER(ModWith)
CARBON_CORE_IDENTIFIER(MulAssignWith)
CARBON_CORE_IDENTIFIER(MulWith)
CARBON_CORE_IDENTIFIER(Negate)
CARBON_CORE_IDENTIFIER(NewCursor)
CARBON_CORE_IDENTIFIER(Next)
CARBON_CORE_IDENTIFIER(NotEqual)
CARBON_CORE_IDENTIFIER(NullptrT)
CARBON_CORE_IDENTIFIER(Op)
CARBON_CORE_IDENTIFIER(Optional)
CARBON_CORE_IDENTIFIER(OrderedWith)
CARBON_CORE_IDENTIFIER(Ref)
CARBON_CORE_IDENTIFIER(RightShiftAssignWith)
CARBON_CORE_IDENTIFIER(RightShiftWith)
CARBON_CORE_IDENTIFIER(SelfDestruct)
CARBON_CORE_IDENTIFIER(String)
CARBON_CORE_IDENTIFIER(SubAssignWith)
CARBON_CORE_IDENTIFIER(SubWith)
CARBON_CORE_IDENTIFIER(SubobjectDestroy)
CARBON_CORE_IDENTIFIER(UInt)
CARBON_CORE_IDENTIFIER(ULong32)
CARBON_CORE_IDENTIFIER(ULong64)
CARBON_CORE_IDENTIFIER(ULongLong64)
CARBON_CORE_IDENTIFIER(UnsafeAs)
CARBON_CORE_IDENTIFIER(VoidBase)
#undef CARBON_CORE_IDENTIFIER