Files
carbon-lang/toolchain/check/core_identifier.def
T
Richard SmithandGeoff Romer ce50f181f1 Add an interface for initialization of vars without an explicit initializer (#6934)
When a `var` is not explicitly given an initializer, initialize it in
one of two ways:

* If its type implements the new interface `Core.Default`, call
`Core.Default.Op` to initialize it.
* Otherwise, if its type implements `UnformedInit`, leave it in an
unformed state. For now, this is always an uninitialized state, but that
will change in the future.
* If neither of those apply, the `var` declaration is ill-formed.

This is a step towards implementing leads decision #6739 and proposals
#257 and #5913.

Assisted-by: Gemini 3.1 Pro via Antigravity

---------

Co-authored-by: Geoff Romer <gromer@google.com>
2026-03-19 23:46:06 +00:00

85 lines
2.9 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(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(CppUnsafeDeref)
CARBON_CORE_IDENTIFIER(Dec)
CARBON_CORE_IDENTIFIER(DefaultOrUnformed)
CARBON_CORE_IDENTIFIER(Destroy)
CARBON_CORE_IDENTIFIER(DivAssignWith)
CARBON_CORE_IDENTIFIER(DivWith)
CARBON_CORE_IDENTIFIER(EqWith)
CARBON_CORE_IDENTIFIER(Equal)
CARBON_CORE_IDENTIFIER(Float)
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(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(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(RightShiftAssignWith)
CARBON_CORE_IDENTIFIER(RightShiftWith)
CARBON_CORE_IDENTIFIER(String)
CARBON_CORE_IDENTIFIER(SubAssignWith)
CARBON_CORE_IDENTIFIER(SubWith)
CARBON_CORE_IDENTIFIER(UInt)
CARBON_CORE_IDENTIFIER(ULong32)
CARBON_CORE_IDENTIFIER(ULongLong64)
CARBON_CORE_IDENTIFIER(UnsafeAs)
CARBON_CORE_IDENTIFIER(VoidBase)
#undef CARBON_CORE_IDENTIFIER