clang  6.0.0svn
Functions
SemaTemplateInstantiateDecl.cpp File Reference
#include "clang/Sema/SemaInternal.h"
#include "clang/AST/ASTConsumer.h"
#include "clang/AST/ASTContext.h"
#include "clang/AST/ASTMutationListener.h"
#include "clang/AST/DeclTemplate.h"
#include "clang/AST/DeclVisitor.h"
#include "clang/AST/DependentDiagnostic.h"
#include "clang/AST/Expr.h"
#include "clang/AST/ExprCXX.h"
#include "clang/AST/TypeLoc.h"
#include "clang/Sema/Initialization.h"
#include "clang/Sema/Lookup.h"
#include "clang/Sema/PrettyDeclStackTrace.h"
#include "clang/Sema/Template.h"
#include "clang/Sema/AttrTemplateInstantiate.inc"
Include dependency graph for SemaTemplateInstantiateDecl.cpp:

Go to the source code of this file.

Functions

static bool isDeclWithinFunction (const Decl *D)
 
template<typename DeclT >
static bool SubstQualifier (Sema &SemaRef, const DeclT *OldDecl, DeclT *NewDecl, const MultiLevelTemplateArgumentList &TemplateArgs)
 
static void instantiateDependentAlignedAttr (Sema &S, const MultiLevelTemplateArgumentList &TemplateArgs, const AlignedAttr *Aligned, Decl *New, bool IsPackExpansion)
 
static void instantiateDependentAlignedAttr (Sema &S, const MultiLevelTemplateArgumentList &TemplateArgs, const AlignedAttr *Aligned, Decl *New)
 
static void instantiateDependentAssumeAlignedAttr (Sema &S, const MultiLevelTemplateArgumentList &TemplateArgs, const AssumeAlignedAttr *Aligned, Decl *New)
 
static void instantiateDependentAlignValueAttr (Sema &S, const MultiLevelTemplateArgumentList &TemplateArgs, const AlignValueAttr *Aligned, Decl *New)
 
static void instantiateDependentAllocAlignAttr (Sema &S, const MultiLevelTemplateArgumentList &TemplateArgs, const AllocAlignAttr *Align, Decl *New)
 
static ExprinstantiateDependentFunctionAttrCondition (Sema &S, const MultiLevelTemplateArgumentList &TemplateArgs, const Attr *A, Expr *OldCond, const Decl *Tmpl, FunctionDecl *New)
 
static void instantiateDependentEnableIfAttr (Sema &S, const MultiLevelTemplateArgumentList &TemplateArgs, const EnableIfAttr *EIA, const Decl *Tmpl, FunctionDecl *New)
 
static void instantiateDependentDiagnoseIfAttr (Sema &S, const MultiLevelTemplateArgumentList &TemplateArgs, const DiagnoseIfAttr *DIA, const Decl *Tmpl, FunctionDecl *New)
 
static void instantiateDependentCUDALaunchBoundsAttr (Sema &S, const MultiLevelTemplateArgumentList &TemplateArgs, const CUDALaunchBoundsAttr &Attr, Decl *New)
 
static void instantiateDependentModeAttr (Sema &S, const MultiLevelTemplateArgumentList &TemplateArgs, const ModeAttr &Attr, Decl *New)
 
static void instantiateOMPDeclareSimdDeclAttr (Sema &S, const MultiLevelTemplateArgumentList &TemplateArgs, const OMPDeclareSimdDeclAttr &Attr, Decl *New)
 Instantiation of 'declare simd' attribute and its arguments. More...
 
static bool DeclContainsAttr (const Decl *D, const Attr *NewAttr)
 
template<typename DeclT >
static DeclT * getPreviousDeclForInstantiation (DeclT *D)
 Get the previous declaration of a declaration for the purposes of template instantiation. More...
 
static QualType adjustFunctionTypeForInstantiation (ASTContext &Context, FunctionDecl *D, TypeSourceInfo *TInfo)
 Adjust the given function type for an instantiation of the given declaration, to cope with modifications to the function's type that aren't reflected in the type-source information. More...
 
static void collectUnexpandedParameterPacks (Sema &S, TemplateParameterList *Params, SmallVectorImpl< UnexpandedParameterPack > &Unexpanded)
 
static bool addInstantiatedParametersToScope (Sema &S, FunctionDecl *Function, const FunctionDecl *PatternDecl, LocalInstantiationScope &Scope, const MultiLevelTemplateArgumentList &TemplateArgs)
 Introduce the instantiated function parameters into the local instantiation scope, and set the parameter names to those used in the template. More...
 
static void InstantiateDefaultCtorDefaultArgs (Sema &S, CXXConstructorDecl *Ctor)
 In the MS ABI, we need to instantiate default arguments of dllexported default constructors along with the constructor definition. More...
 
static bool isInstantiationOf (ClassTemplateDecl *Pattern, ClassTemplateDecl *Instance)
 
static bool isInstantiationOf (FunctionTemplateDecl *Pattern, FunctionTemplateDecl *Instance)
 
static bool isInstantiationOf (ClassTemplatePartialSpecializationDecl *Pattern, ClassTemplatePartialSpecializationDecl *Instance)
 
static bool isInstantiationOf (CXXRecordDecl *Pattern, CXXRecordDecl *Instance)
 
static bool isInstantiationOf (FunctionDecl *Pattern, FunctionDecl *Instance)
 
static bool isInstantiationOf (EnumDecl *Pattern, EnumDecl *Instance)
 
static bool isInstantiationOf (UsingShadowDecl *Pattern, UsingShadowDecl *Instance, ASTContext &C)
 
static bool isInstantiationOf (UsingDecl *Pattern, UsingDecl *Instance, ASTContext &C)
 
template<typename T >
static bool isInstantiationOfUnresolvedUsingDecl (T *Pattern, Decl *Other, ASTContext &Ctx)
 
static bool isInstantiationOfStaticDataMember (VarDecl *Pattern, VarDecl *Instance)
 
static bool isInstantiationOf (ASTContext &Ctx, NamedDecl *D, Decl *Other)
 
template<typename ForwardIterator >
static NamedDeclfindInstantiationOf (ASTContext &Ctx, NamedDecl *D, ForwardIterator first, ForwardIterator last)
 

Function Documentation

◆ addInstantiatedParametersToScope()

static bool addInstantiatedParametersToScope ( Sema S,
FunctionDecl Function,
const FunctionDecl PatternDecl,
LocalInstantiationScope Scope,
const MultiLevelTemplateArgumentList TemplateArgs 
)
static

Introduce the instantiated function parameters into the local instantiation scope, and set the parameter names to those used in the template.

Definition at line 3521 of file SemaTemplateInstantiateDecl.cpp.

Referenced by clang::Sema::InstantiateExceptionSpec(), and clang::Sema::InstantiateFunctionDefinition().

◆ adjustFunctionTypeForInstantiation()

static QualType adjustFunctionTypeForInstantiation ( ASTContext Context,
FunctionDecl D,
TypeSourceInfo TInfo 
)
static

Adjust the given function type for an instantiation of the given declaration, to cope with modifications to the function's type that aren't reflected in the type-source information.

Parameters
DThe declaration we're instantiating.
TInfoThe already-instantiated type.

Definition at line 1573 of file SemaTemplateInstantiateDecl.cpp.

Referenced by clang::TemplateDeclInstantiator::VisitFunctionDecl().

◆ collectUnexpandedParameterPacks()

static void collectUnexpandedParameterPacks ( Sema S,
TemplateParameterList Params,
SmallVectorImpl< UnexpandedParameterPack > &  Unexpanded 
)
static

◆ DeclContainsAttr()

static bool DeclContainsAttr ( const Decl D,
const Attr NewAttr 
)
static

◆ findInstantiationOf()

template<typename ForwardIterator >
static NamedDecl* findInstantiationOf ( ASTContext Ctx,
NamedDecl D,
ForwardIterator  first,
ForwardIterator  last 
)
static

◆ getPreviousDeclForInstantiation()

template<typename DeclT >
static DeclT* getPreviousDeclForInstantiation ( DeclT *  D)
static

◆ InstantiateDefaultCtorDefaultArgs()

static void InstantiateDefaultCtorDefaultArgs ( Sema S,
CXXConstructorDecl Ctor 
)
static

In the MS ABI, we need to instantiate default arguments of dllexported default constructors along with the constructor definition.

This allows IR gen to emit a constructor closure which calls the default constructor with its default arguments.

Definition at line 3732 of file SemaTemplateInstantiateDecl.cpp.

◆ instantiateDependentAlignedAttr() [1/2]

static void instantiateDependentAlignedAttr ( Sema S,
const MultiLevelTemplateArgumentList TemplateArgs,
const AlignedAttr *  Aligned,
Decl New,
bool  IsPackExpansion 
)
static

Definition at line 79 of file SemaTemplateInstantiateDecl.cpp.

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

◆ instantiateDependentAlignedAttr() [2/2]

static void instantiateDependentAlignedAttr ( Sema S,
const MultiLevelTemplateArgumentList TemplateArgs,
const AlignedAttr *  Aligned,
Decl New 
)
static

Definition at line 100 of file SemaTemplateInstantiateDecl.cpp.

◆ instantiateDependentAlignValueAttr()

static void instantiateDependentAlignValueAttr ( Sema S,
const MultiLevelTemplateArgumentList TemplateArgs,
const AlignValueAttr *  Aligned,
Decl New 
)
static

Definition at line 162 of file SemaTemplateInstantiateDecl.cpp.

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

◆ instantiateDependentAllocAlignAttr()

static void instantiateDependentAllocAlignAttr ( Sema S,
const MultiLevelTemplateArgumentList TemplateArgs,
const AllocAlignAttr *  Align,
Decl New 
)
static

Definition at line 174 of file SemaTemplateInstantiateDecl.cpp.

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

◆ instantiateDependentAssumeAlignedAttr()

static void instantiateDependentAssumeAlignedAttr ( Sema S,
const MultiLevelTemplateArgumentList TemplateArgs,
const AssumeAlignedAttr *  Aligned,
Decl New 
)
static

Definition at line 138 of file SemaTemplateInstantiateDecl.cpp.

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

◆ instantiateDependentCUDALaunchBoundsAttr()

static void instantiateDependentCUDALaunchBoundsAttr ( Sema S,
const MultiLevelTemplateArgumentList TemplateArgs,
const CUDALaunchBoundsAttr &  Attr,
Decl New 
)
static

Definition at line 242 of file SemaTemplateInstantiateDecl.cpp.

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

◆ instantiateDependentDiagnoseIfAttr()

static void instantiateDependentDiagnoseIfAttr ( Sema S,
const MultiLevelTemplateArgumentList TemplateArgs,
const DiagnoseIfAttr *  DIA,
const Decl Tmpl,
FunctionDecl New 
)
static

Definition at line 227 of file SemaTemplateInstantiateDecl.cpp.

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

◆ instantiateDependentEnableIfAttr()

static void instantiateDependentEnableIfAttr ( Sema S,
const MultiLevelTemplateArgumentList TemplateArgs,
const EnableIfAttr *  EIA,
const Decl Tmpl,
FunctionDecl New 
)
static

Definition at line 215 of file SemaTemplateInstantiateDecl.cpp.

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

◆ instantiateDependentFunctionAttrCondition()

static Expr* instantiateDependentFunctionAttrCondition ( Sema S,
const MultiLevelTemplateArgumentList TemplateArgs,
const Attr A,
Expr OldCond,
const Decl Tmpl,
FunctionDecl New 
)
static

Definition at line 184 of file SemaTemplateInstantiateDecl.cpp.

◆ instantiateDependentModeAttr()

static void instantiateDependentModeAttr ( Sema S,
const MultiLevelTemplateArgumentList TemplateArgs,
const ModeAttr &  Attr,
Decl New 
)
static

Definition at line 267 of file SemaTemplateInstantiateDecl.cpp.

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

◆ instantiateOMPDeclareSimdDeclAttr()

static void instantiateOMPDeclareSimdDeclAttr ( Sema S,
const MultiLevelTemplateArgumentList TemplateArgs,
const OMPDeclareSimdDeclAttr &  Attr,
Decl New 
)
static

Instantiation of 'declare simd' attribute and its arguments.

Definition at line 275 of file SemaTemplateInstantiateDecl.cpp.

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

◆ isDeclWithinFunction()

static bool isDeclWithinFunction ( const Decl D)
static

◆ isInstantiationOf() [1/9]

static bool isInstantiationOf ( ClassTemplateDecl Pattern,
ClassTemplateDecl Instance 
)
static

◆ isInstantiationOf() [2/9]

static bool isInstantiationOf ( FunctionTemplateDecl Pattern,
FunctionTemplateDecl Instance 
)
static

◆ isInstantiationOf() [3/9]

static bool isInstantiationOf ( ClassTemplatePartialSpecializationDecl Pattern,
ClassTemplatePartialSpecializationDecl Instance 
)
static

◆ isInstantiationOf() [4/9]

static bool isInstantiationOf ( CXXRecordDecl Pattern,
CXXRecordDecl Instance 
)
static

◆ isInstantiationOf() [5/9]

static bool isInstantiationOf ( FunctionDecl Pattern,
FunctionDecl Instance 
)
static

◆ isInstantiationOf() [6/9]

static bool isInstantiationOf ( EnumDecl Pattern,
EnumDecl Instance 
)
static

◆ isInstantiationOf() [7/9]

static bool isInstantiationOf ( UsingShadowDecl Pattern,
UsingShadowDecl Instance,
ASTContext C 
)
static

◆ isInstantiationOf() [8/9]

static bool isInstantiationOf ( UsingDecl Pattern,
UsingDecl Instance,
ASTContext C 
)
static

◆ isInstantiationOf() [9/9]

static bool isInstantiationOf ( ASTContext Ctx,
NamedDecl D,
Decl Other 
)
static

◆ isInstantiationOfStaticDataMember()

static bool isInstantiationOfStaticDataMember ( VarDecl Pattern,
VarDecl Instance 
)
static

◆ isInstantiationOfUnresolvedUsingDecl()

template<typename T >
static bool isInstantiationOfUnresolvedUsingDecl ( T *  Pattern,
Decl Other,
ASTContext Ctx 
)
static

◆ SubstQualifier()

template<typename DeclT >
static bool SubstQualifier ( Sema SemaRef,
const DeclT *  OldDecl,
DeclT *  NewDecl,
const MultiLevelTemplateArgumentList TemplateArgs 
)
static