clang 20.0.0git
Public Types | Public Member Functions | Public Attributes | List of all members
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 , ConstraintNormalization , RequirementParameterInstantiation , ParameterMappingSubstitution ,
  RewritingOperatorAsSpaceship , InitializingStructuredBinding , MarkingClassDllexported , BuildingBuiltinDumpStructCall ,
  Memoization , BuildingDeductionGuides , TypeAliasTemplateInstantiation
}
 The kind of template instantiation we are performing. More...
 

Public Member Functions

ArrayRef< TemplateArgumenttemplate_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 SavedInNonInstantiationSFINAEContext
 Was the enclosing context a non-instantiation SFINAE context?
 
SourceLocation PointOfInstantiation
 The point of instantiation or synthesis within the source code.
 
DeclEntity
 The entity that is being synthesized.
 
NamedDeclTemplate
 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...
 
}; 
 
sema::TemplateDeductionInfoDeductionInfo
 The template deduction info object associated with the substitution or checking of explicit or deduced template arguments.
 
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 12673 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 
ConstraintNormalization 
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.

Definition at line 12675 of file Sema.h.

Constructor & Destructor Documentation

◆ CodeSynthesisContext()

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

Definition at line 12836 of file Sema.h.

Member Function Documentation

◆ isInstantiationRecord()

bool Sema::CodeSynthesisContext::isInstantiationRecord ( ) const

◆ template_arguments()

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

Definition at line 12822 of file Sema.h.

References Kind.

Member Data Documentation

◆ 

union { ... } clang::Sema::CodeSynthesisContext::@252

◆ 

union { ... } clang::Sema::CodeSynthesisContext::@254

◆ CallArgs

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

The list of argument expressions in a synthesized call.

Definition at line 12806 of file Sema.h.

◆ DeductionInfo

sema::TemplateDeductionInfo* clang::Sema::CodeSynthesisContext::DeductionInfo

The template deduction info object associated with the substitution or checking of explicit or deduced template arguments.

Definition at line 12829 of file Sema.h.

◆ Entity

Decl* clang::Sema::CodeSynthesisContext::Entity

◆ 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 12834 of file Sema.h.

◆ Kind

enum clang::Sema::CodeSynthesisContext::SynthesisKind clang::Sema::CodeSynthesisContext::Kind

◆ NumCallArgs

unsigned clang::Sema::CodeSynthesisContext::NumCallArgs

The number of expressions in CallArgs.

Definition at line 12816 of file Sema.h.

◆ NumTemplateArgs

unsigned clang::Sema::CodeSynthesisContext::NumTemplateArgs

The number of template arguments in TemplateArgs.

Definition at line 12813 of file Sema.h.

◆ PointOfInstantiation

SourceLocation clang::Sema::CodeSynthesisContext::PointOfInstantiation

◆ SavedInNonInstantiationSFINAEContext

bool clang::Sema::CodeSynthesisContext::SavedInNonInstantiationSFINAEContext

Was the enclosing context a non-instantiation SFINAE context?

Definition at line 12787 of file Sema.h.

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

◆ SpecialMember

CXXSpecialMemberKind clang::Sema::CodeSynthesisContext::SpecialMember

The special member being declared or defined.

Definition at line 12819 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 12798 of file Sema.h.

◆ 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 12803 of file Sema.h.


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