clang 10.0.0git

Public Types | Public Member Functions | List of all members
clang::TemplateDeclInstantiator Class Reference

`#include "clang/Sema/Template.h"`

Inheritance diagram for clang::TemplateDeclInstantiator:
[legend]
Collaboration diagram for clang::TemplateDeclInstantiator:
[legend]

## Public Types
enum | RewriteKind { RewriteKind::None, RewriteKind::RewriteSpaceshipAsEqualEqual }
using | delayed_partial_spec_iterator = SmallVectorImpl< std::pair< ClassTemplateDecl *, ClassTemplatePartialSpecializationDecl * > >::iterator
using | delayed_var_partial_spec_iterator = SmallVectorImpl< std::pair< VarTemplateDecl *, VarTemplatePartialSpecializationDecl * > >::iterator

## Public Member Functions
| TemplateDeclInstantiator (Sema &SemaRef, DeclContext *Owner, const MultiLevelTemplateArgumentList &TemplateArgs)
void | adjustForRewrite (RewriteKind RK, FunctionDecl *Orig, QualType &T, TypeSourceInfo *&TInfo, DeclarationNameInfo &NameInfo)
Decl * | VisitCXXMethodDecl (CXXMethodDecl *D, TemplateParameterList *TemplateParams, Optional< const ASTTemplateArgumentListInfo *> ClassScopeSpecializationArgs=llvm::None, RewriteKind RK=RewriteKind::None)
Decl * | VisitFunctionDecl (FunctionDecl *D, TemplateParameterList *TemplateParams, RewriteKind RK=RewriteKind::None)
| Normal class members are of more specific types and therefore don't make it here. More...
Decl * | VisitDecl (Decl *D)
Decl * | VisitVarDecl (VarDecl *D, bool InstantiatingVarTemplate, ArrayRef< BindingDecl *> *Bindings=nullptr)
void | enableLateAttributeInstantiation (Sema::LateInstantiatedAttrVec *LA)
void | disableLateAttributeInstantiation ()
LocalInstantiationScope * | getStartingScope () const
delayed_partial_spec_iterator | delayed_partial_spec_begin ()
| Return an iterator to the beginning of the set of "delayed" partial specializations, which must be passed to InstantiateClassTemplatePartialSpecialization once the class definition has been completed. More...
delayed_var_partial_spec_iterator | delayed_var_partial_spec_begin ()
delayed_partial_spec_iterator | delayed_partial_spec_end ()
| Return an iterator to the end of the set of "delayed" partial specializations, which must be passed to InstantiateClassTemplatePartialSpecialization once the class definition has been completed. More...
delayed_var_partial_spec_iterator | delayed_var_partial_spec_end ()
TypeSourceInfo * | SubstFunctionType (FunctionDecl *D, SmallVectorImpl< ParmVarDecl *> &Params)
bool | InitFunctionInstantiation (FunctionDecl *New, FunctionDecl *Tmpl)
| Initializes the common fields of an instantiation function declaration (New) from the corresponding fields of its template (Tmpl). More...
bool | InitMethodInstantiation (CXXMethodDecl *New, CXXMethodDecl *Tmpl)
| Initializes common fields of an instantiated method declaration (New) from the corresponding fields of its template (Tmpl). More...
bool | SubstDefaultedFunction (FunctionDecl *New, FunctionDecl *Tmpl)
TemplateParameterList * | SubstTemplateParams (TemplateParameterList *List)
| Instantiates a nested template parameter list in the current instantiation context. More...
bool | SubstQualifier (const DeclaratorDecl *OldDecl, DeclaratorDecl *NewDecl)
bool | SubstQualifier (const TagDecl *OldDecl, TagDecl *NewDecl)
Decl * | VisitVarTemplateSpecializationDecl (VarTemplateDecl *VarTemplate, VarDecl *FromVar, void *InsertPos, const TemplateArgumentListInfo &TemplateArgsInfo, ArrayRef< TemplateArgument > Converted, VarTemplateSpecializationDecl *PrevDecl=nullptr)
Decl * | InstantiateTypedefNameDecl (TypedefNameDecl *D, bool IsTypeAlias)
ClassTemplatePartialSpecializationDecl * | InstantiateClassTemplatePartialSpecialization (ClassTemplateDecl *ClassTemplate, ClassTemplatePartialSpecializationDecl *PartialSpec)
| Instantiate the declaration of a class template partial specialization. More...
VarTemplatePartialSpecializationDecl * | InstantiateVarTemplatePartialSpecialization (VarTemplateDecl *VarTemplate, VarTemplatePartialSpecializationDecl *PartialSpec)
| Instantiate the declaration of a variable template partial specialization. More...
void | InstantiateEnumDefinition (EnumDecl *Enum, EnumDecl *Pattern)
Public Member Functions inherited from clang::declvisitor::Base< std::add_pointer, TemplateDeclInstantiator, Decl * >
Decl * | Visit (PTR(Decl) D)
Decl * | VisitDecl (PTR(Decl) D)

## Detailed Description

Definition at line 417 of file Template.h.

## Member Typedef Documentation

## ◆ delayed_partial_spec_iterator

using clang::TemplateDeclInstantiator::delayed_partial_spec_iterator = SmallVectorImpl<std::pair< ClassTemplateDecl *, ClassTemplatePartialSpecializationDecl *> >::iterator

Definition at line 511 of file Template.h.

## ◆ delayed_var_partial_spec_iterator

using clang::TemplateDeclInstantiator::delayed_var_partial_spec_iterator = SmallVectorImpl<std::pair< VarTemplateDecl *, VarTemplatePartialSpecializationDecl *> >::iterator

Definition at line 514 of file Template.h.

## Member Enumeration Documentation

## ◆ RewriteKind

enum clang::TemplateDeclInstantiator::RewriteKind
| strong

Enumerator
None |
RewriteSpaceshipAsEqualEqual |

Definition at line 476 of file Template.h.

## Constructor & Destructor Documentation

## ◆ TemplateDeclInstantiator()

clang::TemplateDeclInstantiator::TemplateDeclInstantiator | ( | Sema & | SemaRef,
|  | DeclContext * | Owner,
|  | const MultiLevelTemplateArgumentList & | TemplateArgs
| ) |  |
| inline

Definition at line 443 of file Template.h.

## Member Function Documentation

## ◆ adjustForRewrite()

void TemplateDeclInstantiator::adjustForRewrite | ( | RewriteKind | RK,
|  | FunctionDecl * | Orig,
|  | QualType & | T,
|  | TypeSourceInfo *& | TInfo,
|  | DeclarationNameInfo & | NameInfo
| ) |  |

Definition at line 3640 of file SemaTemplateInstantiateDecl.cpp.

References clang::ASTContext::BoolTy, clang::TypeLoc::castAs(), clang::Type::castAs(), clang::Sema::Context, clang::ASTContext::DeclarationNames, clang::TypeLoc::getAsAdjusted(), clang::DeclarationNameTable::getCXXOperatorName(), clang::Decl::getEndLoc(), clang::ASTContext::getFunctionType(), clang::ASTContext::getTrivialTypeSourceInfo(), clang::TypeSourceInfo::getTypeLoc(), RewriteSpaceshipAsEqualEqual, clang::DeclarationNameInfo::setName(), and clang::FunctionTypeLoc::setParam().

Referenced by VisitCXXMethodDecl(), and VisitFunctionDecl().

## ◆ delayed_partial_spec_begin()

delayed_partial_spec_iterator clang::TemplateDeclInstantiator::delayed_partial_spec_begin | ( |  | ) |
| inline

Return an iterator to the beginning of the set of "delayed" partial specializations, which must be passed to InstantiateClassTemplatePartialSpecialization once the class definition has been completed.

Definition at line 520 of file Template.h.

## ◆ delayed_partial_spec_end()

delayed_partial_spec_iterator clang::TemplateDeclInstantiator::delayed_partial_spec_end | ( |  | ) |
| inline

Return an iterator to the end of the set of "delayed" partial specializations, which must be passed to InstantiateClassTemplatePartialSpecialization once the class definition has been completed.

Definition at line 532 of file Template.h.

## ◆ delayed_var_partial_spec_begin()

delayed_var_partial_spec_iterator clang::TemplateDeclInstantiator::delayed_var_partial_spec_begin | ( |  | ) |
| inline

Definition at line 524 of file Template.h.

## ◆ delayed_var_partial_spec_end()

delayed_var_partial_spec_iterator clang::TemplateDeclInstantiator::delayed_var_partial_spec_end | ( |  | ) |
| inline

Definition at line 536 of file Template.h.

## ◆ disableLateAttributeInstantiation()

void clang::TemplateDeclInstantiator::disableLateAttributeInstantiation | ( |  | ) |
| inline

Definition at line 503 of file Template.h.

## ◆ enableLateAttributeInstantiation()

void clang::TemplateDeclInstantiator::enableLateAttributeInstantiation | ( | Sema::LateInstantiatedAttrVec * | LA | ) |
| inline

Definition at line 497 of file Template.h.

References clang::Sema::CurrentInstantiationScope.

## ◆ getStartingScope()

LocalInstantiationScope* clang::TemplateDeclInstantiator::getStartingScope | ( |  | ) | const
| inline

Definition at line 508 of file Template.h.

## ◆ InitFunctionInstantiation()

bool TemplateDeclInstantiator::InitFunctionInstantiation | ( | FunctionDecl * | New,
|  | FunctionDecl * | Tmpl
| ) |  |

Initializes the common fields of an instantiation function declaration (New) from the corresponding fields of its template (Tmpl).

Returns
  true if there was an error

Definition at line 4275 of file SemaTemplateInstantiateDecl.cpp.

References clang::atTemplateBegin(), clang::atTemplateEnd(), clang::Sema::CodeSynthesisContexts, clang::Sema::Context, clang::EST_BasicNoexcept, clang::EST_DynamicNone, clang::EST_None, clang::EST_Unevaluated, clang::EST_Uninstantiated, clang::FunctionProtoType::ExtProtoInfo::ExceptionSpec, clang::Type::getAs(), clang::FunctionProtoType::getExtProtoInfo(), clang::ASTContext::getFunctionType(), clang::Sema::getLangOpts(), clang::ASTContext::getManglingNumber(), clang::FunctionType::getNoReturnAttr(), clang::FunctionProtoType::getParamTypes(), clang::FunctionType::getReturnType(), clang::ValueDecl::getType(), clang::FunctionProtoType::hasExceptionSpec(), clang::Sema::InstantiateAttrs(), clang::FunctionDecl::isDefined(), clang::Decl::isImplicit(), clang::Decl::isLexicallyWithinFunctionOrMethod(), clang::Decl::setImplicit(), clang::ASTContext::setManglingNumber(), clang::ValueDecl::setType(), clang::FunctionProtoType::ExceptionSpecInfo::SourceDecl, clang::FunctionProtoType::ExceptionSpecInfo::SourceTemplate, clang::Sema::SubstExceptionSpec(), clang::Sema::TemplateInstCallbacks, and clang::FunctionProtoType::ExceptionSpecInfo::Type.

Referenced by InitMethodInstantiation(), and VisitFunctionDecl().

## ◆ InitMethodInstantiation()

bool TemplateDeclInstantiator::InitMethodInstantiation | ( | CXXMethodDecl * | New,
|  | CXXMethodDecl * | Tmpl
| ) |  |

Initializes common fields of an instantiated method declaration (New) from the corresponding fields of its template (Tmpl).

Returns
  true if there was an error

Definition at line 4361 of file SemaTemplateInstantiateDecl.cpp.

References clang::Sema::AdjustDestructorExceptionSpec(), clang::Decl::getAccess(), clang::Sema::getLangOpts(), InitFunctionInstantiation(), clang::FunctionDecl::isVirtualAsWritten(), clang::Decl::setAccess(), and clang::FunctionDecl::setVirtualAsWritten().

Referenced by VisitCXXMethodDecl().

## ◆ InstantiateClassTemplatePartialSpecialization()

ClassTemplatePartialSpecializationDecl * TemplateDeclInstantiator::InstantiateClassTemplatePartialSpecialization | ( | ClassTemplateDecl * | ClassTemplate,
|  | ClassTemplatePartialSpecializationDecl * | PartialSpec
| ) |  |

Instantiate the declaration of a class template partial specialization.

Parameters

  ClassTemplate | the (instantiated) class template that is partially
  PartialSpec | the (uninstantiated) class template partial specialization that we are instantiating.

Returns
  The instantiated partial specialization, if successful; otherwise, NULL to indicate an error.

Definition at line 3771 of file SemaTemplateInstantiateDecl.cpp.

References clang::Sema::CheckTemplateArgumentList(), clang::Sema::CheckTemplatePartialSpecialization(), clang::Sema::CheckTemplatePartialSpecializationArgs(), clang::Sema::Context, clang::ClassTemplatePartialSpecializationDecl::Create(), clang::Sema::Diag(), clang::ClassTemplateDecl::findPartialSpecialization(), clang::TypeDecl::getBeginLoc(), clang::Decl::getLocation(), clang::TagDecl::getTagKind(), clang::ASTTemplateArgumentListInfo::getTemplateArgs(), clang::ClassTemplatePartialSpecializationDecl::getTemplateArgsAsWritten(), clang::ClassTemplatePartialSpecializationDecl::getTemplateParameters(), clang::ASTContext::getTemplateSpecializationType(), clang::ASTContext::getTemplateSpecializationTypeInfo(), clang::TypeSourceInfo::getType(), clang::ASTContext::getTypeDeclType(), clang::ASTTemplateArgumentListInfo::LAngleLoc, clang::ASTTemplateArgumentListInfo::NumTemplateArgs, clang::ASTTemplateArgumentListInfo::RAngleLoc, clang::ClassTemplatePartialSpecializationDecl::setInstantiatedFromMember(), clang::ClassTemplateSpecializationDecl::setTypeAsWritten(), clang::TemplateArgumentListInfo::size(), clang::Sema::Subst(), SubstQualifier(), and SubstTemplateParams().

## ◆ InstantiateEnumDefinition()

void TemplateDeclInstantiator::InstantiateEnumDefinition | ( | EnumDecl * | Enum,
|  | EnumDecl * | Pattern
| ) |  |

Definition at line 1271 of file SemaTemplateInstantiateDecl.cpp.

References clang::Sema::ActOnEnumBody(), clang::DeclContext::addDecl(), clang::CXXScopeSpec::Adopt(), clang::Sema::CheckEnumConstant(), clang::Sema::CheckTemplateParameterList(), clang::Sema::computeDeclContext(), clang::Sema::ConstantEvaluated, clang::Sema::Context, clang::CXXRecordDecl::Create(), clang::ClassTemplateDecl::Create(), clang::Sema::CurrentInstantiationScope, clang::Sema::Diag(), clang::DeclContextLookupResult::empty(), clang::EnumDecl::enumerators(), clang::Sema::FindInstantiatedContext(), clang::Decl::FOK_None, clang::Sema::forRedeclarationInCurContext(), clang::DeclContextLookupResult::front(), clang::ActionResult< PtrTy, CompressInvalid >::get(), clang::Decl::getAccess(), clang::TypeDecl::getBeginLoc(), clang::TagDecl::getBraceRange(), clang::Decl::getDeclContext(), clang::NamedDecl::getDeclName(), clang::Decl::getFriendObjectKind(), clang::NamedDecl::getIdentifier(), getIdentifier(), clang::ClassTemplateDecl::getInjectedClassNameSpecialization(), clang::ASTContext::getInjectedClassNameType(), clang::Decl::getLexicalDeclContext(), clang::Decl::getLocation(), clang::ClassTemplateDecl::getMostRecentDecl(), clang::DeclContext::getParent(), getPreviousDeclForInstantiation(), clang::TagDecl::getQualifierLoc(), clang::NestedNameSpecifierLoc::getSourceRange(), clang::TagDecl::getTagKind(), clang::ClassTemplateDecl::getTemplatedDecl(), clang::TemplateDecl::getTemplateParameters(), clang::Sema::InstantiateAttrs(), clang::Sema::InstantiateAttrsForDecl(), clang::LocalInstantiationScope::InstantiatedLocal(), clang::DeclContext::isDependentContext(), clang::DeclContext::isFunctionOrMethod(), clang::ActionResult< PtrTy, CompressInvalid >::isInvalid(), isInvalid(), clang::DeclContext::isNamespace(), clang::Decl::isOutOfLine(), clang::EnumDecl::isScoped(), clang::IdentifierInfo::isStr(), clang::DeclContext::lookup(), clang::Sema::LookupOrdinaryName, clang::Sema::LookupQualifiedName(), clang::DeclContext::makeDeclVisibleInContext(), clang::Decl::setAccess(), clang::CXXRecordDecl::setDescribedClassTemplate(), clang::RedeclarableTemplateDecl::setInstantiatedFromMemberTemplate(), clang::Decl::setInvalidDecl(), clang::Decl::setLexicalDeclContext(), clang::Decl::setLocation(), clang::Decl::setObjectOfFriendDecl(), clang::Redeclarable< decl_type >::setPreviousDecl(), clang::TagDecl::setQualifierInfo(), clang::TagDecl::startDefinition(), clang::Sema::SubstExpr(), clang::Sema::SubstNestedNameSpecifierLoc(), SubstTemplateParams(), clang::Sema::TemplateParameterListsAreEqual(), clang::Sema::TPC_ClassTemplate, and clang::Sema::TPL_TemplateMatch.

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

## ◆ InstantiateTypedefNameDecl()

Decl * TemplateDeclInstantiator::InstantiateTypedefNameDecl | ( | TypedefNameDecl * | D,
|  | bool | IsTypeAlias
| ) |  |

Definition at line 736 of file SemaTemplateInstantiateDecl.cpp.

References clang::DeclContext::addDecl(), clang::DecompositionDecl::bindings(), clang::Type::castAs(), clang::Sema::Context, clang::TypeAliasTemplateDecl::Create(), clang::TypedefDecl::Create(), clang::TypeAliasDecl::Create(), clang::BindingDecl::Create(), clang::Sema::CurrentInstantiationScope, clang::DeclContextLookupResult::empty(), clang::Sema::FindInstantiatedDecl(), clang::DeclContextLookupResult::front(), clang::Decl::getAccess(), clang::Type::getAs(), clang::TypeDecl::getBeginLoc(), clang::Decl::getDeclContext(), clang::NamedDecl::getDeclName(), clang::NamedDecl::getIdentifier(), clang::Decl::getLocation(), clang::QualType::getNonReferenceType(), getPreviousDeclForInstantiation(), clang::Sema::getSourceManager(), clang::Sema::getStdNamespace(), clang::TypeAliasTemplateDecl::getTemplatedDecl(), clang::TemplateDecl::getTemplateParameters(), clang::ASTContext::getTrivialTypeSourceInfo(), clang::TypeSourceInfo::getType(), clang::TagDecl::getTypedefNameForAnonDecl(), clang::TypedefNameDecl::getTypeSourceInfo(), clang::DecltypeType::getUnderlyingExpr(), clang::TypedefNameDecl::getUnderlyingType(), clang::TagDecl::hasNameForLinkage(), clang::Sema::inferGslPointerAttribute(), clang::Sema::InstantiateAttrs(), clang::LocalInstantiationScope::InstantiatedLocal(), clang::ASTContext::IntTy, clang::Sema::isIncompatibleTypedef(), clang::Type::isInstantiationDependentType(), clang::SourceManager::isInSystemHeader(), clang::Decl::isReferenced(), clang::Type::isReferenceType(), clang::IdentifierInfo::isStr(), clang::Type::isVariablyModifiedType(), clang::DeclContext::lookup(), clang::Sema::MarkDeclarationsReferencedInType(), clang::Decl::setAccess(), clang::RedeclarableTemplateDecl::setInstantiatedFromMemberTemplate(), clang::Decl::setInvalidDecl(), clang::Redeclarable< decl_type >::setPreviousDecl(), clang::Decl::setReferenced(), clang::TagDecl::setTypedefNameForAnonDecl(), SubstTemplateParams(), clang::Sema::SubstType(), and VisitVarDecl().

## ◆ InstantiateVarTemplatePartialSpecialization()

VarTemplatePartialSpecializationDecl * TemplateDeclInstantiator::InstantiateVarTemplatePartialSpecialization | ( | VarTemplateDecl * | VarTemplate,
|  | VarTemplatePartialSpecializationDecl * | PartialSpec
| ) |  |

Instantiate the declaration of a variable template partial specialization.

Parameters

  VarTemplate | the (instantiated) variable template that is partially specialized by the instantiation of `PartialSpec`.
  PartialSpec | the (uninstantiated) variable template partial specialization that we are instantiating.

Returns
  The instantiated partial specialization, if successful; otherwise, NULL to indicate an error.

Definition at line 3899 of file SemaTemplateInstantiateDecl.cpp.

References clang::Sema::BuildVariableInstantiation(), clang::Sema::CheckTemplateArgumentList(), clang::Sema::CheckTemplatePartialSpecialization(), clang::Sema::CheckTemplatePartialSpecializationArgs(), clang::Sema::Context, clang::VarTemplatePartialSpecializationDecl::Create(), clang::Sema::Diag(), clang::VarTemplateDecl::findPartialSpecialization(), clang::NamedDecl::getDeclName(), clang::DeclaratorDecl::getInnerLocStart(), clang::Decl::getLocation(), clang::VarDecl::getStorageClass(), clang::ASTTemplateArgumentListInfo::getTemplateArgs(), clang::VarTemplatePartialSpecializationDecl::getTemplateArgsAsWritten(), clang::VarTemplatePartialSpecializationDecl::getTemplateParameters(), clang::ASTContext::getTemplateSpecializationType(), clang::ASTContext::getTemplateSpecializationTypeInfo(), clang::TypeSourceInfo::getType(), clang::DeclaratorDecl::getTypeSourceInfo(), clang::DeclaratorDecl::getTypeSpecStartLoc(), clang::Type::isFunctionType(), clang::VarDecl::isStaticDataMember(), clang::ASTTemplateArgumentListInfo::LAngleLoc, clang::ASTTemplateArgumentListInfo::NumTemplateArgs, clang::ASTTemplateArgumentListInfo::RAngleLoc, clang::VarTemplatePartialSpecializationDecl::setInstantiatedFromMember(), clang::VarTemplateSpecializationDecl::setTypeAsWritten(), clang::TemplateArgumentListInfo::size(), clang::Sema::Subst(), SubstQualifier(), SubstTemplateParams(), and clang::Sema::SubstType().

## ◆ SubstDefaultedFunction()

bool TemplateDeclInstantiator::SubstDefaultedFunction | ( | FunctionDecl * | New,
|  | FunctionDecl * | Tmpl
| ) |  |

Definition at line 4377 of file SemaTemplateInstantiateDecl.cpp.

References clang::Sema::Context, clang::FunctionDecl::DefaultedFunctionInfo::Create(), clang::Sema::FindInstantiatedDecl(), clang::Decl::getAccess(), clang::FunctionDecl::getDefaultedFunctionInfo(), clang::Decl::getLocation(), clang::DeclAccessPair::make(), clang::Sema::SetDeclDefaulted(), and clang::FunctionDecl::setDefaultedFunctionInfo().

Referenced by VisitCXXMethodDecl(), and VisitFunctionDecl().

## ◆ SubstFunctionType()

TypeSourceInfo * TemplateDeclInstantiator::SubstFunctionType | ( | FunctionDecl * | D,
|  | SmallVectorImpl< ParmVarDecl *> & | Params
| ) |  |

Definition at line 4026 of file SemaTemplateInstantiateDecl.cpp.

References clang::Sema::BuildParmVarDeclForTypedef(), clang::TypeLoc::castAs(), clang::Sema::CurrentInstantiationScope, clang::TypeLoc::getAs(), clang::NamedDecl::getDeclName(), clang::Decl::getLocation(), clang::Sema::getNumArgumentsInExpansion(), clang::FunctionTypeLoc::getParam(), clang::FunctionProtoType::getParamType(), clang::ValueDecl::getType(), clang::TypeSourceInfo::getTypeLoc(), clang::DeclaratorDecl::getTypeSourceInfo(), clang::DeclaratorDecl::getTypeSpecStartLoc(), clang::TypeLoc::IgnoreParens(), clang::LocalInstantiationScope::InstantiatedLocal(), clang::LocalInstantiationScope::InstantiatedLocalPackArg(), clang::VarDecl::isParameterPack(), clang::LocalInstantiationScope::MakeInstantiatedLocalArgPack(), clang::FunctionDecl::parameters(), clang::Sema::SubstFunctionDeclType(), and clang::Sema::SubstParmTypes().

Referenced by VisitCXXMethodDecl(), and VisitFunctionDecl().

## ◆ SubstQualifier() [1/2]

bool TemplateDeclInstantiator::SubstQualifier | ( | const DeclaratorDecl * | OldDecl,
|  | DeclaratorDecl * | NewDecl
| ) |  |

Definition at line 67 of file SemaTemplateInstantiateDecl.cpp.

References SubstQualifier().

Referenced by InstantiateClassTemplatePartialSpecialization(), InstantiateVarTemplatePartialSpecialization(), VisitVarDecl(), and VisitVarTemplateSpecializationDecl().

## ◆ SubstQualifier() [2/2]

bool TemplateDeclInstantiator::SubstQualifier | ( | const TagDecl * | OldDecl,
|  | TagDecl * | NewDecl
| ) |  |

Definition at line 72 of file SemaTemplateInstantiateDecl.cpp.

References SubstQualifier().

## ◆ SubstTemplateParams()

TemplateParameterList * TemplateDeclInstantiator::SubstTemplateParams | ( | TemplateParameterList * | L | ) |

Instantiates a nested template parameter list in the current instantiation context.

Parameters

  L | The parameter list to instantiate

Returns
  NULL if there was an error

Definition at line 3714 of file SemaTemplateInstantiateDecl.cpp.

References clang::Sema::Context, clang::TemplateParameterList::Create(), clang::ActionResult< PtrTy, CompressInvalid >::get(), clang::ActionResult< PtrTy, CompressInvalid >::isInvalid(), clang::Decl::isInvalidDecl(), clang::ActionResult< PtrTy, CompressInvalid >::isUsable(), P, clang::TemplateParameterList::size(), clang::Sema::SubstExpr(), clang::Sema::Unevaluated, and clang::declvisitor::Base< std::add_pointer, TemplateDeclInstantiator, Decl * >::Visit().

Referenced by InstantiateClassTemplatePartialSpecialization(), InstantiateEnumDefinition(), InstantiateTypedefNameDecl(), InstantiateVarTemplatePartialSpecialization(), clang::Sema::SubstTemplateParams(), and VisitCXXMethodDecl().

## ◆ VisitCXXMethodDecl()

Decl * TemplateDeclInstantiator::VisitCXXMethodDecl | ( | CXXMethodDecl * | D,
|  | TemplateParameterList * | TemplateParams,
|  | Optional< const ASTTemplateArgumentListInfo *> | ClassScopeSpecializationArgs = `llvm::None`,
|  | RewriteKind | RK = `RewriteKind::None`
| ) |  |

Definition at line 2123 of file SemaTemplateInstantiateDecl.cpp.

References clang::LookupResult::addDecl(), clang::DeclContext::addDecl(), adjustForRewrite(), adjustFunctionTypeForInstantiation(), clang::CXXScopeSpec::Adopt(), clang::AS_public, clang::Sema::AttachTypeConstraint(), clang::TypeLoc::castAs(), clang::Sema::CheckConstraintExpression(), clang::Sema::CheckFriendAccess(), clang::Sema::CheckFunctionDeclaration(), clang::Sema::CheckFunctionTemplateSpecialization(), clang::Sema::CheckNonTypeTemplateParameterType(), clang::Sema::CheckOverrideControl(), clang::Sema::CheckPackExpansion(), clang::Sema::CheckParameterPacksForExpansion(), clang::Sema::CheckPureMethod(), clang::LookupResult::clear(), clang::Sema::collectUnexpandedParameterPacks(), clang::Sema::CompleteMemberSpecialization(), clang::Sema::computeDeclContext(), clang::Sema::ConstantEvaluated, clang::Sema::Context, clang::FunctionTemplateDecl::Create(), clang::TemplateTypeParmDecl::Create(), clang::NonTypeTemplateParmDecl::Create(), clang::CXXMethodDecl::Create(), clang::CXXConstructorDecl::Create(), clang::CXXDestructorDecl::Create(), clang::CXXConversionDecl::Create(), clang::TemplateArgumentList::CreateCopy(), clang::Sema::CurrentInstantiationScope, clang::TemplateTypeParmDecl::defaultArgumentWasInherited(), clang::NonTypeTemplateParmDecl::defaultArgumentWasInherited(), clang::LookupResult::empty(), clang::Sema::FindInstantiatedContext(), clang::Sema::FindInstantiatedDecl(), clang::FunctionTemplateDecl::findSpecialization(), clang::Decl::FOK_None, clang::Sema::ForExternalRedeclaration, clang::ActionResult< PtrTy, CompressInvalid >::get(), clang::Decl::getAccess(), clang::TypeDecl::getBeginLoc(), clang::FunctionDecl::getConstexprKind(), clang::TypeLoc::getContainedAutoTypeLoc(), clang::Decl::getDeclContext(), clang::NamedDecl::getDeclName(), clang::NonTypeTemplateParmDecl::getDefaultArgument(), clang::TemplateTypeParmDecl::getDefaultArgumentInfo(), clang::TemplateTypeParmDecl::getDefaultArgumentLoc(), clang::FunctionDecl::getDependentSpecializationInfo(), clang::TemplateParmPosition::getDepth(), clang::TemplateTypeParmDecl::getDepth(), clang::FunctionDecl::getDescribedFunctionTemplate(), clang::PackExpansionTypeLoc::getEllipsisLoc(), clang::Decl::getEndLoc(), clang::NonTypeTemplateParmDecl::getExpansionTypeSourceInfo(), clang::Decl::getFriendObjectKind(), clang::ExplicitSpecifier::getFromDecl(), clang::NamedDecl::getIdentifier(), clang::TemplateTypeParmDecl::getIndex(), clang::DeclaratorDecl::getInnerLocStart(), clang::MultiLevelTemplateArgumentList::getInnermost(), clang::Decl::getLexicalDeclContext(), clang::Decl::getLocation(), clang::FunctionDecl::getNameInfo(), clang::PackExpansionType::getNumExpansions(), clang::NonTypeTemplateParmDecl::getNumExpansionTypes(), clang::MultiLevelTemplateArgumentList::getNumSubstitutedLevels(), clang::DeclaratorDecl::getNumTemplateParameterLists(), clang::PackExpansionTypeLoc::getPatternLoc(), clang::TemplateParmPosition::getPosition(), clang::Redeclarable< decl_type >::getPreviousDecl(), clang::DeclaratorDecl::getQualifierLoc(), clang::ASTTemplateArgumentListInfo::getTemplateArgs(), clang::DeclaratorDecl::getTemplateParameterList(), clang::FunctionDecl::getTemplateSpecializationArgsAsWritten(), clang::DeclaratorDecl::getTrailingRequiresClause(), clang::TypeSourceInfo::getType(), clang::TemplateTypeParmDecl::getTypeConstraint(), clang::TypeDecl::getTypeForDecl(), clang::TypeSourceInfo::getTypeLoc(), clang::ConcreteTypeLoc< Base, Derived, TypeClass, LocalData >::getTypePtr(), clang::DeclaratorDecl::getTypeSourceInfo(), clang::TemplateTypeParmDecl::hasDefaultArgument(), clang::NonTypeTemplateParmDecl::hasDefaultArgument(), clang::TemplateTypeParmDecl::hasTypeConstraint(), InitMethodInstantiation(), clang::LocalInstantiationScope::InstantiatedLocal(), instantiateExplicitSpecifier(), clang::ASTContext::IntTy, clang::FunctionDecl::isDeletedAsWritten(), clang::TemplateTypeParmDecl::isExpandedParameterPack(), clang::NonTypeTemplateParmDecl::isExpandedParameterPack(), clang::FunctionDecl::isExplicitlyDefaulted(), clang::Decl::isImplicit(), clang::FunctionDecl::isInlined(), clang::FunctionDecl::isInlineSpecified(), clang::ActionResult< PtrTy, CompressInvalid >::isInvalid(), clang::ExplicitSpecifier::isInvalid(), clang::QualType::isNull(), clang::FunctionDecl::isOutOfLine(), clang::TemplateTypeParmDecl::isPackExpansion(), clang::NonTypeTemplateParmDecl::isPackExpansion(), clang::TemplateTypeParmDecl::isParameterPack(), clang::NonTypeTemplateParmDecl::isParameterPack(), clang::FunctionDecl::isPure(), clang::LookupResult::isSingleTagDecl(), clang::CXXMethodDecl::isStatic(), clang::Type::isTemplateTypeParmType(), clang::ASTTemplateArgumentListInfo::LAngleLoc, clang::Sema::LookupOrdinaryName, clang::Sema::LookupQualifiedName(), clang::DeclContext::makeDeclVisibleInContext(), clang::Sema::MarkFunctionReferenced(), None, clang::ASTTemplateArgumentListInfo::NumTemplateArgs, P, Previous, clang::ASTTemplateArgumentListInfo::RAngleLoc, clang::Sema::RequireCompleteDeclContext(), clang::SC_None, clang::SC_Static, clang::Decl::setAccess(), clang::Sema::SetDeclDeleted(), clang::TemplateTypeParmDecl::setDefaultArgument(), clang::Decl::setImplicit(), clang::FunctionDecl::setImplicitlyInline(), clang::TemplateArgumentListInfo::setLAngleLoc(), clang::Decl::setLexicalDeclContext(), clang::Decl::setObjectOfFriendDecl(), clang::FunctionDecl::setRangeEnd(), clang::TemplateArgumentListInfo::setRAngleLoc(), clang::Sema::Subst(), clang::Sema::SubstDeclarationNameInfo(), SubstDefaultedFunction(), clang::Sema::SubstExpr(), SubstFunctionType(), clang::Sema::SubstNestedNameSpecifierLoc(), clang::Sema::SubstParmVarDecl(), SubstTemplateParams(), clang::Sema::SubstType(), clang::TSK_ImplicitInstantiation, clang::Sema::Unevaluated, and clang::TemplateTypeParmDecl::wasDeclaredWithTypename().

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

## ◆ VisitDecl()

Decl * TemplateDeclInstantiator::VisitDecl | ( | Decl * | D | ) |

Definition at line 3623 of file SemaTemplateInstantiateDecl.cpp.

## ◆ VisitFunctionDecl()

Decl * TemplateDeclInstantiator::VisitFunctionDecl | ( | FunctionDecl * | D,
|  | TemplateParameterList * | TemplateParams,
|  | RewriteKind | FunctionRewriteKind = `RewriteKind::None`
| ) |  |

Normal class members are of more specific types and therefore don't make it here.

This function serves three purposes: 1) instantiating function templates 2) substituting friend declarations 3) substituting deduction guide declarations for nested class templates

Definition at line 1796 of file SemaTemplateInstantiateDecl.cpp.

References clang::Sema::adjustContextForLocalExternDecl(), adjustForRewrite(), adjustFunctionTypeForInstantiation(), clang::CXXScopeSpec::Adopt(), clang::Sema::CheckConstraintExpression(), clang::Sema::CheckForFunctionRedefinition(), clang::Sema::CheckFunctionDeclaration(), clang::Sema::CheckFunctionTemplateSpecialization(), clang::Sema::CheckTemplateParameterList(), clang::Sema::computeDeclContext(), clang::Sema::Context, clang::FunctionTemplateDecl::Create(), clang::CXXDeductionGuideDecl::Create(), clang::FunctionDecl::Create(), clang::TemplateArgumentList::CreateCopy(), clang::Sema::FindInstantiatedContext(), clang::Sema::FindInstantiatedDecl(), clang::FunctionTemplateDecl::findSpecialization(), clang::Decl::FOK_None, clang::Sema::ForExternalRedeclaration, clang::Sema::forRedeclarationInCurContext(), clang::ActionResult< PtrTy, CompressInvalid >::get(), clang::Decl::getAccess(), clang::FunctionDecl::getCanonicalDecl(), clang::FunctionDecl::getConstexprKind(), clang::Decl::getDeclContext(), clang::NamedDecl::getDeclName(), clang::FunctionDecl::getDependentSpecializationInfo(), clang::FunctionDecl::getDescribedFunctionTemplate(), clang::SourceRange::getEnd(), clang::Decl::getFriendObjectKind(), clang::DeclaratorDecl::getInnerLocStart(), clang::MultiLevelTemplateArgumentList::getInnermost(), clang::Decl::getLocation(), clang::FunctionDecl::getMemberSpecializationInfo(), clang::FunctionDecl::getNameInfo(), clang::Redeclarable< decl_type >::getPreviousDecl(), clang::FunctionTemplateDecl::getPreviousDecl(), clang::DeclaratorDecl::getQualifierLoc(), clang::FunctionDecl::getSourceRange(), clang::FunctionDecl::getStorageClass(), clang::TemplateDecl::getTemplateParameters(), clang::FunctionDecl::getTemplateSpecializationArgsAsWritten(), clang::DeclaratorDecl::getTrailingRequiresClause(), clang::FunctionDecl::hasWrittenPrototype(), clang::Decl::IDNS_Ordinary, InitFunctionInstantiation(), instantiateExplicitSpecifier(), clang::FunctionDecl::isDeleted(), clang::FunctionDecl::isExplicitlyDefaulted(), clang::DeclContext::isFileContext(), clang::DeclContext::isFunctionOrMethod(), clang::Decl::isInIdentifierNamespace(), clang::FunctionDecl::isInlined(), clang::FunctionDecl::isInlineSpecified(), clang::ActionResult< PtrTy, CompressInvalid >::isInvalid(), clang::ExplicitSpecifier::isInvalid(), clang::Decl::isInvalidDecl(), clang::Decl::isLocalExternDecl(), clang::FunctionDecl::isOutOfLine(), clang::FunctionDecl::isOverloadedOperator(), clang::DeclContext::isRecord(), clang::FunctionDecl::isThisDeclarationADefinition(), clang::Sema::LookupOrdinaryName, clang::Sema::LookupQualifiedName(), clang::Sema::LookupRedeclarationWithLinkage, clang::DeclContext::makeDeclVisibleInContext(), None, P, clang::Sema::PendingLocalImplicitInstantiations, Previous, clang::Redeclarable< decl_type >::redecls(), clang::Decl::setAccess(), clang::Sema::SetDeclDeleted(), clang::FunctionDecl::setDescribedFunctionTemplate(), clang::FunctionDecl::setImplicitlyInline(), clang::RedeclarableTemplateDecl::setInstantiatedFromMemberTemplate(), clang::Decl::setInvalidDecl(), clang::CXXDeductionGuideDecl::setIsCopyDeductionCandidate(), clang::Decl::setLexicalDeclContext(), clang::Decl::setLocalExternDecl(), clang::Decl::setNonMemberOperator(), clang::Decl::setObjectOfFriendDecl(), clang::DeclaratorDecl::setQualifierInfo(), clang::FunctionDecl::setRangeEnd(), clang::DeclaratorDecl::setTrailingRequiresClause(), clang::Sema::Subst(), clang::Sema::SubstDeclarationNameInfo(), SubstDefaultedFunction(), clang::Sema::SubstExpr(), SubstFunctionType(), clang::Sema::SubstNestedNameSpecifierLoc(), clang::Sema::TPC_FriendFunctionTemplate, clang::Sema::TPC_FriendFunctionTemplateDefinition, clang::TSK_ImplicitInstantiation, and clang::Sema::Unevaluated.

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

## ◆ VisitVarDecl()

Decl * TemplateDeclInstantiator::VisitVarDecl | ( | VarDecl * | D,
|  | bool | InstantiatingVarTemplate,
|  | ArrayRef< BindingDecl *> * | Bindings = `nullptr`
| ) |  |

Definition at line 896 of file SemaTemplateInstantiateDecl.cpp.

References clang::DeclContext::addDecl(), clang::DeclContext::addHiddenDecl(), clang::Sema::adjustContextForLocalExternDecl(), clang::Sema::BuildVariableInstantiation(), clang::Sema::CES_Strict, clang::IndirectFieldDecl::chain(), clang::Sema::CheckAlignasUnderalignment(), clang::Sema::CheckFieldDecl(), clang::Sema::CheckStaticLocalForDllExport(), clang::Sema::ConstantEvaluated, clang::Sema::Context, clang::AccessSpecDecl::Create(), clang::VarDecl::Create(), clang::DecompositionDecl::Create(), clang::MSPropertyDecl::Create(), clang::Sema::CurrentInstantiationScope, clang::Sema::deduceOpenCLAddressSpace(), clang::Sema::Diag(), clang::Decl::getAccess(), clang::AccessSpecDecl::getAccessSpecifierLoc(), clang::ActionResult< PtrTy, CompressInvalid >::getAs(), clang::DeclaratorDecl::getBeginLoc(), clang::FieldDecl::getBitWidth(), clang::IndirectFieldDecl::getChainingSize(), clang::AccessSpecDecl::getColonLoc(), clang::NamedDecl::getDeclName(), clang::MSPropertyDecl::getGetterId(), clang::NamedDecl::getIdentifier(), clang::FieldDecl::getInClassInitStyle(), clang::DeclaratorDecl::getInnerLocStart(), clang::Sema::getLangOpts(), clang::Decl::getLocation(), clang::MSPropertyDecl::getSetterId(), clang::VarDecl::getStorageClass(), clang::TypeSourceInfo::getType(), clang::DeclaratorDecl::getTypeSourceInfo(), clang::DeclaratorDecl::getTypeSpecStartLoc(), clang::Sema::inferObjCARCLifetime(), clang::Sema::InstantiateAttrs(), clang::LocalInstantiationScope::InstantiatedLocal(), clang::Sema::isCopyElisionCandidate(), clang::Type::isFunctionType(), clang::Decl::isImplicit(), clang::Type::isInstantiationDependentType(), clang::ActionResult< PtrTy, CompressInvalid >::isInvalid(), clang::Decl::isLocalExternDecl(), clang::FieldDecl::isMutable(), clang::VarDecl::isNRVOVariable(), clang::VarDecl::isStaticDataMember(), clang::Type::isVariablyModifiedType(), clang::Sema::MarkDeclarationsReferencedInType(), Parent, clang::Property, clang::Decl::setAccess(), clang::ASTContext::setInstantiatedFromUnnamedFieldDecl(), clang::Decl::setInvalidDecl(), clang::Sema::SubstExpr(), SubstQualifier(), and clang::Sema::SubstType().

Referenced by InstantiateTypedefNameDecl().

## ◆ VisitVarTemplateSpecializationDecl()

Decl * TemplateDeclInstantiator::VisitVarTemplateSpecializationDecl | ( | VarTemplateDecl * | VarTemplate,
|  | VarDecl * | FromVar,
|  | void * | InsertPos,
|  | const TemplateArgumentListInfo & | TemplateArgsInfo,
|  | ArrayRef< TemplateArgument > | Converted,
|  | VarTemplateSpecializationDecl * | PrevDecl = `nullptr`
| ) |  |

Definition at line 3513 of file SemaTemplateInstantiateDecl.cpp.

References clang::VarTemplateDecl::AddSpecialization(), clang::Sema::BuildVariableInstantiation(), clang::Sema::CheckSpecializationInstantiationRedecl(), clang::Sema::CheckTemplateArgumentList(), clang::Sema::Context, clang::RequiresExprBodyDecl::Create(), clang::VarTemplateSpecializationDecl::Create(), clang::Sema::Diag(), clang::DiagnosticsEngine::Error, clang::Sema::FindInstantiatedDecl(), clang::VarTemplateDecl::findSpecialization(), clang::TemplateArgumentListInfo::getArgumentArray(), clang::Decl::getBeginLoc(), clang::DiagnosticsEngine::getCustomDiagID(), clang::Decl::getDeclContext(), clang::Decl::getDeclKindName(), clang::NamedDecl::getDeclName(), clang::Sema::getDiagnostics(), clang::DeclaratorDecl::getInnerLocStart(), clang::TemplateArgumentListInfo::getLAngleLoc(), clang::Decl::getLocation(), clang::VarTemplateSpecializationDecl::getPointOfInstantiation(), clang::TemplateArgumentListInfo::getRAngleLoc(), clang::VarTemplateSpecializationDecl::getSpecializationKind(), clang::VarTemplateSpecializationDecl::getSpecializedTemplate(), clang::VarDecl::getStorageClass(), clang::VarTemplateSpecializationDecl::getTemplateArgsInfo(), clang::TypeSourceInfo::getType(), clang::DeclaratorDecl::getTypeSourceInfo(), clang::DeclaratorDecl::getTypeSpecStartLoc(), clang::Type::isFunctionType(), clang::VarDecl::isStaticDataMember(), clang::TemplateArgumentListInfo::setLAngleLoc(), clang::TemplateArgumentListInfo::setRAngleLoc(), clang::VarTemplateSpecializationDecl::setTemplateArgsInfo(), clang::TemplateArgumentListInfo::size(), clang::Sema::Subst(), SubstQualifier(), and clang::Sema::SubstType().

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

- include/clang/Sema/Template.h
- lib/Sema/SemaTemplateInstantiateDecl.cpp