clang 24.0.0git
clang::Sema::CodeSynthesisContext Struct Reference

A context in which code is being synthesized (where a source location alone is not sufficient to identify the context). More...

#include "clang/Sema/Sema.h"

Public Types

enum  SynthesisKind {
  TemplateInstantiation , DefaultTemplateArgumentInstantiation , DefaultFunctionArgumentInstantiation , ExplicitTemplateArgumentSubstitution ,
  DeducedTemplateArgumentSubstitution , LambdaExpressionSubstitution , PriorTemplateArgumentSubstitution , DefaultTemplateArgumentChecking ,
  ExceptionSpecEvaluation , ExceptionSpecInstantiation , RequirementInstantiation , NestedRequirementConstraintsCheck ,
  DeclaringSpecialMember , DeclaringImplicitEqualityComparison , DefiningSynthesizedFunction , ConstraintsCheck ,
  ConstraintSubstitution , RequirementParameterInstantiation , ParameterMappingSubstitution , RewritingOperatorAsSpaceship ,
  InitializingStructuredBinding , MarkingClassDllexported , BuildingBuiltinDumpStructCall , Memoization ,
  BuildingDeductionGuides , TypeAliasTemplateInstantiation , PartialOrderingTTP , SYCLKernelLaunchLookup ,
  SYCLKernelLaunchOverloadResolution , ExpansionStmtInstantiation
}
 The kind of template instantiation we are performing. More...

Public Member Functions

ArrayRef< TemplateArgument > template_arguments () const
 CodeSynthesisContext ()
bool isInstantiationRecord () const
 Determines whether this template is an actual instantiation that should be counted toward the maximum instantiation depth.

Public Attributes

enum clang::Sema::CodeSynthesisContext::SynthesisKind Kind
bool InConstraintSubstitution
 Whether we're substituting into constraints.
bool InParameterMappingSubstitution
 Whether we're substituting into the parameter mapping of a constraint.
SourceLocation PointOfInstantiation
 The point of instantiation or synthesis within the source code.
Decl * Entity
 The entity that is being synthesized.
NamedDecl * Template
 The template (or partial specialization) in which we are performing the instantiation, for substitutions of prior template arguments.
union { 
   const TemplateArgument *   TemplateArgs 
 The list of template arguments we are substituting, if they are not part of the entity. More...
   const Expr *const *   CallArgs 
 The list of argument expressions in a synthesized call. More...
}; 
union { 
   unsigned   NumTemplateArgs 
 The number of template arguments in TemplateArgs. More...
   unsigned   NumCallArgs 
 The number of expressions in CallArgs. More...
   CXXSpecialMemberKind   SpecialMember 
 The special member being declared or defined. More...
}; 
SourceRange InstantiationRange
 The source range that covers the construct that cause the instantiation, e.g., the template-id that causes a class template instantiation.

Detailed Description

A context in which code is being synthesized (where a source location alone is not sufficient to identify the context).

This covers template instantiation and various forms of implicitly-generated functions.

Definition at line 13283 of file Sema.h.

Member Enumeration Documentation

◆ SynthesisKind

The kind of template instantiation we are performing.

Enumerator
TemplateInstantiation 

We are instantiating a template declaration.

The entity is the declaration we're instantiating (e.g., a CXXRecordDecl).

DefaultTemplateArgumentInstantiation 

We are instantiating a default argument for a template parameter.

The Entity is the template parameter whose argument is being instantiated, the Template is the template, and the TemplateArgs/NumTemplateArguments provide the template arguments as specified.

DefaultFunctionArgumentInstantiation 

We are instantiating a default argument for a function.

The Entity is the ParmVarDecl, and TemplateArgs/NumTemplateArgs provides the template arguments as specified.

ExplicitTemplateArgumentSubstitution 

We are substituting explicit template arguments provided for a function template.

The entity is a FunctionTemplateDecl.

DeducedTemplateArgumentSubstitution 

We are substituting template argument determined as part of template argument deduction for either a class template partial specialization or a function template.

The Entity is either a {Class|Var}TemplatePartialSpecializationDecl or a TemplateDecl.

LambdaExpressionSubstitution 

We are substituting into a lambda expression.

PriorTemplateArgumentSubstitution 

We are substituting prior template arguments into a new template parameter.

The template parameter itself is either a NonTypeTemplateParmDecl or a TemplateTemplateParmDecl.

DefaultTemplateArgumentChecking 

We are checking the validity of a default template argument that has been used when naming a template-id.

ExceptionSpecEvaluation 

We are computing the exception specification for a defaulted special member function.

ExceptionSpecInstantiation 

We are instantiating the exception specification for a function template which was deferred until it was needed.

RequirementInstantiation 

We are instantiating a requirement of a requires expression.

NestedRequirementConstraintsCheck 

We are checking the satisfaction of a nested requirement of a requires expression.

DeclaringSpecialMember 

We are declaring an implicit special member function.

DeclaringImplicitEqualityComparison 

We are declaring an implicit 'operator==' for a defaulted 'operator<=>'.

DefiningSynthesizedFunction 

We are defining a synthesized function (such as a defaulted special member).

ConstraintsCheck 
ConstraintSubstitution 
RequirementParameterInstantiation 
ParameterMappingSubstitution 
RewritingOperatorAsSpaceship 

We are rewriting a comparison operator in terms of an operator<=>.

InitializingStructuredBinding 

We are initializing a structured binding.

MarkingClassDllexported 

We are marking a class as __dllexport.

BuildingBuiltinDumpStructCall 

We are building an implied call from __builtin_dump_struct.

The arguments are in CallArgs.

Memoization 

Added for Template instantiation observation.

Memoization means we are not instantiating a template because it is already instantiated (but we entered a context where we would have had to if it was not already instantiated).

BuildingDeductionGuides 

We are building deduction guides for a class.

TypeAliasTemplateInstantiation 

We are instantiating a type alias template declaration.

PartialOrderingTTP 

We are performing partial ordering for template template parameters.

SYCLKernelLaunchLookup 

We are performing name lookup for a function template or variable template named 'sycl_kernel_launch'.

SYCLKernelLaunchOverloadResolution 

We are performing overload resolution for a call to a function template or variable template named 'sycl_kernel_launch'.

ExpansionStmtInstantiation 

We are instantiating an expansion statement.

Definition at line 13285 of file Sema.h.

Constructor & Destructor Documentation

◆ CodeSynthesisContext()

clang::Sema::CodeSynthesisContext::CodeSynthesisContext ( )
inline

Member Function Documentation

◆ isInstantiationRecord()

◆ template_arguments()

ArrayRef< TemplateArgument > clang::Sema::CodeSynthesisContext::template_arguments ( ) const
inline

Definition at line 13446 of file Sema.h.

References DeclaringSpecialMember, Kind, NumTemplateArgs, and TemplateArgs.

Member Data Documentation

◆ [union]

◆ [union]

◆ CallArgs

const Expr* const* clang::Sema::CodeSynthesisContext::CallArgs

The list of argument expressions in a synthesized call.

Definition at line 13430 of file Sema.h.

◆ Entity

◆ InConstraintSubstitution

bool clang::Sema::CodeSynthesisContext::InConstraintSubstitution

Whether we're substituting into constraints.

Definition at line 13408 of file Sema.h.

Referenced by CodeSynthesisContext().

◆ InParameterMappingSubstitution

bool clang::Sema::CodeSynthesisContext::InParameterMappingSubstitution

Whether we're substituting into the parameter mapping of a constraint.

Definition at line 13411 of file Sema.h.

Referenced by CodeSynthesisContext().

◆ InstantiationRange

SourceRange clang::Sema::CodeSynthesisContext::InstantiationRange

The source range that covers the construct that cause the instantiation, e.g., the template-id that causes a class template instantiation.

Definition at line 13454 of file Sema.h.

Referenced by clang::Sema::pushCodeSynthesisContext().

◆ Kind

◆ NumCallArgs

unsigned clang::Sema::CodeSynthesisContext::NumCallArgs

The number of expressions in CallArgs.

Definition at line 13440 of file Sema.h.

◆ NumTemplateArgs

unsigned clang::Sema::CodeSynthesisContext::NumTemplateArgs

The number of template arguments in TemplateArgs.

Definition at line 13437 of file Sema.h.

Referenced by CodeSynthesisContext(), and template_arguments().

◆ PointOfInstantiation

SourceLocation clang::Sema::CodeSynthesisContext::PointOfInstantiation

◆ SpecialMember

CXXSpecialMemberKind clang::Sema::CodeSynthesisContext::SpecialMember

The special member being declared or defined.

Definition at line 13443 of file Sema.h.

◆ Template

NamedDecl* clang::Sema::CodeSynthesisContext::Template

The template (or partial specialization) in which we are performing the instantiation, for substitutions of prior template arguments.

Definition at line 13422 of file Sema.h.

Referenced by CodeSynthesisContext().

◆ TemplateArgs

const TemplateArgument* clang::Sema::CodeSynthesisContext::TemplateArgs

The list of template arguments we are substituting, if they are not part of the entity.

Definition at line 13427 of file Sema.h.

Referenced by CodeSynthesisContext(), and template_arguments().


The documentation for this struct was generated from the following files: