summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib/Sema/SemaTemplateInstantiateDecl.cpp')
-rw-r--r--clang/lib/Sema/SemaTemplateInstantiateDecl.cpp304
1 files changed, 153 insertions, 151 deletions
diff --git a/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp b/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
index 66afaaa458f..2a0f56baa70 100644
--- a/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
+++ b/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
@@ -132,7 +132,7 @@ static void instantiateDependentAlignedAttr(
static void instantiateDependentEnableIfAttr(
Sema &S, const MultiLevelTemplateArgumentList &TemplateArgs,
const EnableIfAttr *A, const Decl *Tmpl, Decl *New) {
- Expr *Cond = 0;
+ Expr *Cond = nullptr;
{
EnterExpressionEvaluationContext Unevaluated(S, Sema::Unevaluated);
ExprResult Result = S.SubstExpr(A->getCond(), TemplateArgs);
@@ -187,7 +187,7 @@ void Sema::InstantiateAttrs(const MultiLevelTemplateArgumentList &TemplateArgs,
if (TmplAttr->isLateParsed() && LateAttrs) {
// Late parsed attributes must be instantiated and attached after the
// enclosing class has been instantiated. See Sema::InstantiateClass.
- LocalInstantiationScope *Saved = 0;
+ LocalInstantiationScope *Saved = nullptr;
if (CurrentInstantiationScope)
Saved = CurrentInstantiationScope->cloneScopes(OuterMostScope);
LateAttrs->push_back(LateInstantiatedAttribute(TmplAttr, Saved, New));
@@ -297,7 +297,7 @@ Decl *TemplateDeclInstantiator::InstantiateTypedefNameDecl(TypedefNameDecl *D,
NamedDecl *InstPrev = SemaRef.FindInstantiatedDecl(D->getLocation(), Prev,
TemplateArgs);
if (!InstPrev)
- return 0;
+ return nullptr;
TypedefNameDecl *InstPrevTypedef = cast<TypedefNameDecl>(InstPrev);
@@ -335,11 +335,11 @@ TemplateDeclInstantiator::VisitTypeAliasTemplateDecl(TypeAliasTemplateDecl *D) {
TemplateParameterList *TempParams = D->getTemplateParameters();
TemplateParameterList *InstParams = SubstTemplateParams(TempParams);
if (!InstParams)
- return 0;
+ return nullptr;
TypeAliasDecl *Pattern = D->getTemplatedDecl();
- TypeAliasTemplateDecl *PrevAliasTemplate = 0;
+ TypeAliasTemplateDecl *PrevAliasTemplate = nullptr;
if (Pattern->getPreviousDecl()) {
DeclContext::lookup_result Found = Owner->lookup(Pattern->getDeclName());
if (!Found.empty()) {
@@ -350,7 +350,7 @@ TemplateDeclInstantiator::VisitTypeAliasTemplateDecl(TypeAliasTemplateDecl *D) {
TypeAliasDecl *AliasInst = cast_or_null<TypeAliasDecl>(
InstantiateTypedefNameDecl(Pattern, /*IsTypeAlias=*/true));
if (!AliasInst)
- return 0;
+ return nullptr;
TypeAliasTemplateDecl *Inst
= TypeAliasTemplateDecl::Create(SemaRef.Context, Owner, D->getLocation(),
@@ -380,7 +380,7 @@ Decl *TemplateDeclInstantiator::VisitVarDecl(VarDecl *D,
if (const RecordType *RecordTy = D->getType()->getAs<RecordType>())
if (RecordTy->getDecl()->isAnonymousStructOrUnion())
if (!VisitCXXRecordDecl(cast<CXXRecordDecl>(RecordTy->getDecl())))
- return 0;
+ return nullptr;
// Do substitution on the type of the declaration
TypeSourceInfo *DI = SemaRef.SubstType(D->getTypeSourceInfo(),
@@ -388,12 +388,12 @@ Decl *TemplateDeclInstantiator::VisitVarDecl(VarDecl *D,
D->getTypeSpecStartLoc(),
D->getDeclName());
if (!DI)
- return 0;
+ return nullptr;
if (DI->getType()->isFunctionType()) {
SemaRef.Diag(D->getLocation(), diag::err_variable_instantiates_to_function)
<< D->isStaticDataMember() << DI->getType();
- return 0;
+ return nullptr;
}
DeclContext *DC = Owner;
@@ -412,7 +412,7 @@ Decl *TemplateDeclInstantiator::VisitVarDecl(VarDecl *D,
// Substitute the nested name specifier, if any.
if (SubstQualifier(D, Var))
- return 0;
+ return nullptr;
SemaRef.BuildVariableInstantiation(Var, D, TemplateArgs, LateAttrs, Owner,
StartingScope, InstantiatingVarTemplate);
@@ -461,7 +461,7 @@ Decl *TemplateDeclInstantiator::VisitFieldDecl(FieldDecl *D) {
Expr *BitWidth = D->getBitWidth();
if (Invalid)
- BitWidth = 0;
+ BitWidth = nullptr;
else if (BitWidth) {
// The bit-width expression is a constant expression.
EnterExpressionEvaluationContext Unevaluated(SemaRef,
@@ -471,7 +471,7 @@ Decl *TemplateDeclInstantiator::VisitFieldDecl(FieldDecl *D) {
= SemaRef.SubstExpr(BitWidth, TemplateArgs);
if (InstantiatedBitWidth.isInvalid()) {
Invalid = true;
- BitWidth = 0;
+ BitWidth = nullptr;
} else
BitWidth = InstantiatedBitWidth.takeAs<Expr>();
}
@@ -485,10 +485,10 @@ Decl *TemplateDeclInstantiator::VisitFieldDecl(FieldDecl *D) {
D->getInClassInitStyle(),
D->getInnerLocStart(),
D->getAccess(),
- 0);
+ nullptr);
if (!Field) {
cast<Decl>(Owner)->setInvalidDecl();
- return 0;
+ return nullptr;
}
SemaRef.InstantiateAttrs(TemplateArgs, D, Field, LateAttrs, StartingScope);
@@ -570,7 +570,7 @@ Decl *TemplateDeclInstantiator::VisitIndirectFieldDecl(IndirectFieldDecl *D) {
NamedDecl *Next = SemaRef.FindInstantiatedDecl(D->getLocation(), PI,
TemplateArgs);
if (!Next)
- return 0;
+ return nullptr;
NamedChain[i++] = Next;
}
@@ -604,12 +604,12 @@ Decl *TemplateDeclInstantiator::VisitFriendDecl(FriendDecl *D) {
D->getLocation(), DeclarationName());
}
if (!InstTy)
- return 0;
+ return nullptr;
FriendDecl *FD = SemaRef.CheckFriendTypeDecl(D->getLocStart(),
D->getFriendLoc(), InstTy);
if (!FD)
- return 0;
+ return nullptr;
FD->setAccess(AS_public);
FD->setUnsupportedFriend(D->isUnsupportedFriend());
@@ -625,7 +625,7 @@ Decl *TemplateDeclInstantiator::VisitFriendDecl(FriendDecl *D) {
// objects, with the most important detail being that the target
// decl should almost certainly not be placed in Owner.
Decl *NewND = Visit(ND);
- if (!NewND) return 0;
+ if (!NewND) return nullptr;
FriendDecl *FD =
FriendDecl::Create(SemaRef.Context, Owner, D->getLocation(),
@@ -646,7 +646,7 @@ Decl *TemplateDeclInstantiator::VisitStaticAssertDecl(StaticAssertDecl *D) {
ExprResult InstantiatedAssertExpr
= SemaRef.SubstExpr(AssertExpr, TemplateArgs);
if (InstantiatedAssertExpr.isInvalid())
- return 0;
+ return nullptr;
return SemaRef.BuildStaticAssertDeclaration(D->getLocation(),
InstantiatedAssertExpr.get(),
@@ -656,12 +656,12 @@ Decl *TemplateDeclInstantiator::VisitStaticAssertDecl(StaticAssertDecl *D) {
}
Decl *TemplateDeclInstantiator::VisitEnumDecl(EnumDecl *D) {
- EnumDecl *PrevDecl = 0;
+ EnumDecl *PrevDecl = nullptr;
if (D->getPreviousDecl()) {
NamedDecl *Prev = SemaRef.FindInstantiatedDecl(D->getLocation(),
D->getPreviousDecl(),
TemplateArgs);
- if (!Prev) return 0;
+ if (!Prev) return nullptr;
PrevDecl = cast<EnumDecl>(Prev);
}
@@ -694,7 +694,7 @@ Decl *TemplateDeclInstantiator::VisitEnumDecl(EnumDecl *D) {
Enum->setAccess(D->getAccess());
// Forward the mangling number from the template to the instantiated decl.
SemaRef.Context.setManglingNumber(Enum, SemaRef.Context.getManglingNumber(D));
- if (SubstQualifier(D, Enum)) return 0;
+ if (SubstQualifier(D, Enum)) return nullptr;
Owner->addDecl(Enum);
EnumDecl *Def = D->getDefinition();
@@ -736,10 +736,10 @@ void TemplateDeclInstantiator::InstantiateEnumDefinition(
SmallVector<Decl*, 4> Enumerators;
- EnumConstantDecl *LastEnumConst = 0;
+ EnumConstantDecl *LastEnumConst = nullptr;
for (auto *EC : Pattern->enumerators()) {
// The specified value for the enumerator.
- ExprResult Value = SemaRef.Owned((Expr *)0);
+ ExprResult Value = SemaRef.Owned((Expr *)nullptr);
if (Expr *UninstValue = EC->getInitExpr()) {
// The enumerator's value expression is a constant expression.
EnterExpressionEvaluationContext Unevaluated(SemaRef,
@@ -751,7 +751,7 @@ void TemplateDeclInstantiator::InstantiateEnumDefinition(
// Drop the initial value and continue.
bool isInvalid = false;
if (Value.isInvalid()) {
- Value = SemaRef.Owned((Expr *)0);
+ Value = SemaRef.Owned((Expr *)nullptr);
isInvalid = true;
}
@@ -787,7 +787,7 @@ void TemplateDeclInstantiator::InstantiateEnumDefinition(
SemaRef.ActOnEnumBody(Enum->getLocation(), SourceLocation(),
Enum->getRBraceLoc(), Enum,
Enumerators,
- 0, 0);
+ nullptr, nullptr);
}
Decl *TemplateDeclInstantiator::VisitEnumConstantDecl(EnumConstantDecl *D) {
@@ -803,7 +803,7 @@ Decl *TemplateDeclInstantiator::VisitClassTemplateDecl(ClassTemplateDecl *D) {
TemplateParameterList *TempParams = D->getTemplateParameters();
TemplateParameterList *InstParams = SubstTemplateParams(TempParams);
if (!InstParams)
- return NULL;
+ return nullptr;
CXXRecordDecl *Pattern = D->getTemplatedDecl();
@@ -815,11 +815,11 @@ Decl *TemplateDeclInstantiator::VisitClassTemplateDecl(ClassTemplateDecl *D) {
QualifierLoc = SemaRef.SubstNestedNameSpecifierLoc(QualifierLoc,
TemplateArgs);
if (!QualifierLoc)
- return 0;
+ return nullptr;
}
- CXXRecordDecl *PrevDecl = 0;
- ClassTemplateDecl *PrevClassTemplate = 0;
+ CXXRecordDecl *PrevDecl = nullptr;
+ ClassTemplateDecl *PrevClassTemplate = nullptr;
if (!isFriend && Pattern->getPreviousDecl()) {
DeclContext::lookup_result Found = Owner->lookup(Pattern->getDeclName());
@@ -840,7 +840,7 @@ Decl *TemplateDeclInstantiator::VisitClassTemplateDecl(ClassTemplateDecl *D) {
CXXScopeSpec SS;
SS.Adopt(QualifierLoc);
DC = SemaRef.computeDeclContext(SS);
- if (!DC) return 0;
+ if (!DC) return nullptr;
} else {
DC = SemaRef.FindInstantiatedContext(Pattern->getLocation(),
Pattern->getDeclContext(),
@@ -863,7 +863,7 @@ Decl *TemplateDeclInstantiator::VisitClassTemplateDecl(ClassTemplateDecl *D) {
SemaRef.Diag(Pattern->getLocation(), diag::err_not_tag_in_scope)
<< D->getTemplatedDecl()->getTagKind() << Pattern->getDeclName() << DC
<< QualifierLoc.getSourceRange();
- return 0;
+ return nullptr;
}
bool AdoptedPreviousTemplateParams = false;
@@ -902,7 +902,7 @@ Decl *TemplateDeclInstantiator::VisitClassTemplateDecl(ClassTemplateDecl *D) {
Complain,
Sema::TPL_TemplateMatch)) {
if (Complain)
- return 0;
+ return nullptr;
AdoptedPreviousTemplateParams = true;
InstParams = PrevParams;
@@ -913,7 +913,7 @@ Decl *TemplateDeclInstantiator::VisitClassTemplateDecl(ClassTemplateDecl *D) {
if (!AdoptedPreviousTemplateParams &&
SemaRef.CheckTemplateParameterList(InstParams, PrevParams,
Sema::TPC_ClassTemplate))
- return 0;
+ return nullptr;
}
}
@@ -990,12 +990,12 @@ TemplateDeclInstantiator::VisitClassTemplatePartialSpecializationDecl(
DeclContext::lookup_result Found
= Owner->lookup(ClassTemplate->getDeclName());
if (Found.empty())
- return 0;
+ return nullptr;
ClassTemplateDecl *InstClassTemplate
= dyn_cast<ClassTemplateDecl>(Found.front());
if (!InstClassTemplate)
- return 0;
+ return nullptr;
if (ClassTemplatePartialSpecializationDecl *Result
= InstClassTemplate->findPartialSpecInstantiatedFromMember(D))
@@ -1014,10 +1014,10 @@ Decl *TemplateDeclInstantiator::VisitVarTemplateDecl(VarTemplateDecl *D) {
TemplateParameterList *TempParams = D->getTemplateParameters();
TemplateParameterList *InstParams = SubstTemplateParams(TempParams);
if (!InstParams)
- return NULL;
+ return nullptr;
VarDecl *Pattern = D->getTemplatedDecl();
- VarTemplateDecl *PrevVarTemplate = 0;
+ VarTemplateDecl *PrevVarTemplate = nullptr;
if (Pattern->getPreviousDecl()) {
DeclContext::lookup_result Found = Owner->lookup(Pattern->getDeclName());
@@ -1095,9 +1095,9 @@ TemplateDeclInstantiator::VisitFunctionTemplateDecl(FunctionTemplateDecl *D) {
TemplateParameterList *TempParams = D->getTemplateParameters();
TemplateParameterList *InstParams = SubstTemplateParams(TempParams);
if (!InstParams)
- return NULL;
+ return nullptr;
- FunctionDecl *Instantiated = 0;
+ FunctionDecl *Instantiated = nullptr;
if (CXXMethodDecl *DMethod = dyn_cast<CXXMethodDecl>(D->getTemplatedDecl()))
Instantiated = cast_or_null<FunctionDecl>(VisitCXXMethodDecl(DMethod,
InstParams));
@@ -1107,7 +1107,7 @@ TemplateDeclInstantiator::VisitFunctionTemplateDecl(FunctionTemplateDecl *D) {
InstParams));
if (!Instantiated)
- return 0;
+ return nullptr;
// Link the instantiated function template declaration to the function
// template from which it was instantiated.
@@ -1137,14 +1137,14 @@ TemplateDeclInstantiator::VisitFunctionTemplateDecl(FunctionTemplateDecl *D) {
}
Decl *TemplateDeclInstantiator::VisitCXXRecordDecl(CXXRecordDecl *D) {
- CXXRecordDecl *PrevDecl = 0;
+ CXXRecordDecl *PrevDecl = nullptr;
if (D->isInjectedClassName())
PrevDecl = cast<CXXRecordDecl>(Owner);
else if (D->getPreviousDecl()) {
NamedDecl *Prev = SemaRef.FindInstantiatedDecl(D->getLocation(),
D->getPreviousDecl(),
TemplateArgs);
- if (!Prev) return 0;
+ if (!Prev) return nullptr;
PrevDecl = cast<CXXRecordDecl>(Prev);
}
@@ -1155,7 +1155,7 @@ Decl *TemplateDeclInstantiator::VisitCXXRecordDecl(CXXRecordDecl *D) {
// Substitute the nested name specifier, if any.
if (SubstQualifier(D, Record))
- return 0;
+ return nullptr;
Record->setImplicit(D->isImplicit());
// FIXME: Check against AS_none is an ugly hack to work around the issue that
@@ -1230,7 +1230,7 @@ Decl *TemplateDeclInstantiator::VisitFunctionDecl(FunctionDecl *D,
if (FunctionTemplate && !TemplateParams) {
ArrayRef<TemplateArgument> Innermost = TemplateArgs.getInnermost();
- void *InsertPos = 0;
+ void *InsertPos = nullptr;
FunctionDecl *SpecFunc
= FunctionTemplate->findSpecialization(Innermost.begin(), Innermost.size(),
InsertPos);
@@ -1246,7 +1246,7 @@ Decl *TemplateDeclInstantiator::VisitFunctionDecl(FunctionDecl *D,
else
isFriend = (D->getFriendObjectKind() != Decl::FOK_None);
- bool MergeWithParentScope = (TemplateParams != 0) ||
+ bool MergeWithParentScope = (TemplateParams != nullptr) ||
Owner->isFunctionOrMethod() ||
!(isa<Decl>(Owner) &&
cast<Decl>(Owner)->isDefinedOutsideFunctionOrMethod());
@@ -1255,7 +1255,7 @@ Decl *TemplateDeclInstantiator::VisitFunctionDecl(FunctionDecl *D,
SmallVector<ParmVarDecl *, 4> Params;
TypeSourceInfo *TInfo = SubstFunctionType(D, Params);
if (!TInfo)
- return 0;
+ return nullptr;
QualType T = adjustFunctionTypeForInstantiation(SemaRef.Context, D, TInfo);
NestedNameSpecifierLoc QualifierLoc = D->getQualifierLoc();
@@ -1263,7 +1263,7 @@ Decl *TemplateDeclInstantiator::VisitFunctionDecl(FunctionDecl *D,
QualifierLoc = SemaRef.SubstNestedNameSpecifierLoc(QualifierLoc,
TemplateArgs);
if (!QualifierLoc)
- return 0;
+ return nullptr;
}
// If we're instantiating a local function declaration, put the result
@@ -1277,7 +1277,7 @@ Decl *TemplateDeclInstantiator::VisitFunctionDecl(FunctionDecl *D,
CXXScopeSpec SS;
SS.Adopt(QualifierLoc);
DC = SemaRef.computeDeclContext(SS);
- if (!DC) return 0;
+ if (!DC) return nullptr;
} else {
DC = SemaRef.FindInstantiatedContext(D->getLocation(), D->getDeclContext(),
TemplateArgs);
@@ -1351,7 +1351,7 @@ Decl *TemplateDeclInstantiator::VisitFunctionDecl(FunctionDecl *D,
TemplateArgumentList::CreateCopy(SemaRef.Context,
Innermost.begin(),
Innermost.size()),
- /*InsertPos=*/0);
+ /*InsertPos=*/nullptr);
} else if (isFriend) {
// Note, we need this connection even if the friend doesn't have a body.
// Its body may exist but not have been attached yet due to deferred
@@ -1385,14 +1385,14 @@ Decl *TemplateDeclInstantiator::VisitFunctionDecl(FunctionDecl *D,
Info->getRAngleLoc());
if (SemaRef.Subst(Info->getTemplateArgs(), Info->getNumTemplateArgs(),
ExplicitArgs, TemplateArgs))
- return 0;
+ return nullptr;
// Map the candidate templates to their instantiations.
for (unsigned I = 0, E = Info->getNumTemplates(); I != E; ++I) {
Decl *Temp = SemaRef.FindInstantiatedDecl(D->getLocation(),
Info->getTemplate(I),
TemplateArgs);
- if (!Temp) return 0;
+ if (!Temp) return nullptr;
Previous.addDecl(cast<FunctionTemplateDecl>(Temp));
}
@@ -1418,7 +1418,7 @@ Decl *TemplateDeclInstantiator::VisitFunctionDecl(FunctionDecl *D,
Previous.clear();
}
- SemaRef.CheckFunctionDeclaration(/*Scope*/ 0, Function, Previous,
+ SemaRef.CheckFunctionDeclaration(/*Scope*/ nullptr, Function, Previous,
isExplicitSpecialization);
NamedDecl *PrincipalDecl = (TemplateParams
@@ -1441,7 +1441,7 @@ Decl *TemplateDeclInstantiator::VisitFunctionDecl(FunctionDecl *D,
// to these implicit definitions.
if (D->isThisDeclarationADefinition()) {
// Check for a function body.
- const FunctionDecl *Definition = 0;
+ const FunctionDecl *Definition = nullptr;
if (Function->isDefined(Definition) &&
Definition->getTemplateSpecializationKind() == TSK_Undeclared) {
SemaRef.Diag(Function->getLocation(), diag::err_redefinition)
@@ -1508,7 +1508,7 @@ TemplateDeclInstantiator::VisitCXXMethodDecl(CXXMethodDecl *D,
// specialization for this particular set of template arguments.
ArrayRef<TemplateArgument> Innermost = TemplateArgs.getInnermost();
- void *InsertPos = 0;
+ void *InsertPos = nullptr;
FunctionDecl *SpecFunc
= FunctionTemplate->findSpecialization(Innermost.begin(),
Innermost.size(),
@@ -1525,7 +1525,7 @@ TemplateDeclInstantiator::VisitCXXMethodDecl(CXXMethodDecl *D,
else
isFriend = (D->getFriendObjectKind() != Decl::FOK_None);
- bool MergeWithParentScope = (TemplateParams != 0) ||
+ bool MergeWithParentScope = (TemplateParams != nullptr) ||
!(isa<Decl>(Owner) &&
cast<Decl>(Owner)->isDefinedOutsideFunctionOrMethod());
LocalInstantiationScope Scope(SemaRef, MergeWithParentScope);
@@ -1539,7 +1539,7 @@ TemplateDeclInstantiator::VisitCXXMethodDecl(CXXMethodDecl *D,
TemplateParameterList *TempParams = D->getTemplateParameterList(I);
TemplateParameterList *InstParams = SubstTemplateParams(TempParams);
if (!InstParams)
- return NULL;
+ return nullptr;
TempParamLists[I] = InstParams;
}
}
@@ -1547,7 +1547,7 @@ TemplateDeclInstantiator::VisitCXXMethodDecl(CXXMethodDecl *D,
SmallVector<ParmVarDecl *, 4> Params;
TypeSourceInfo *TInfo = SubstFunctionType(D, Params);
if (!TInfo)
- return 0;
+ return nullptr;
QualType T = adjustFunctionTypeForInstantiation(SemaRef.Context, D, TInfo);
NestedNameSpecifierLoc QualifierLoc = D->getQualifierLoc();
@@ -1555,7 +1555,7 @@ TemplateDeclInstantiator::VisitCXXMethodDecl(CXXMethodDecl *D,
QualifierLoc = SemaRef.SubstNestedNameSpecifierLoc(QualifierLoc,
TemplateArgs);
if (!QualifierLoc)
- return 0;
+ return nullptr;
}
DeclContext *DC = Owner;
@@ -1566,18 +1566,18 @@ TemplateDeclInstantiator::VisitCXXMethodDecl(CXXMethodDecl *D,
DC = SemaRef.computeDeclContext(SS);
if (DC && SemaRef.RequireCompleteDeclContext(SS, DC))
- return 0;
+ return nullptr;
} else {
DC = SemaRef.FindInstantiatedContext(D->getLocation(),
D->getDeclContext(),
TemplateArgs);
}
- if (!DC) return 0;
+ if (!DC) return nullptr;
}
// Build the instantiated method declaration.
CXXRecordDecl *Record = cast<CXXRecordDecl>(DC);
- CXXMethodDecl *Method = 0;
+ CXXMethodDecl *Method = nullptr;
SourceLocation StartLoc = D->getInnerLocStart();
DeclarationNameInfo NameInfo
@@ -1603,7 +1603,7 @@ TemplateDeclInstantiator::VisitCXXMethodDecl(CXXMethodDecl *D,
Sema::InstantiatingTemplate Inst(SemaRef, Constructor->getLocation(),
Inh);
if (Inst.isInvalid())
- return 0;
+ return nullptr;
Sema::ContextRAII SavedContext(SemaRef, Inh->getDeclContext());
LocalInstantiationScope LocalScope(SemaRef);
@@ -1614,7 +1614,7 @@ TemplateDeclInstantiator::VisitCXXMethodDecl(CXXMethodDecl *D,
Inh = cast_or_null<CXXConstructorDecl>(
SemaRef.SubstDecl(Inh, Inh->getDeclContext(), InheritedArgs));
if (!Inh)
- return 0;
+ return nullptr;
}
cast<CXXConstructorDecl>(Method)->setInheritedConstructor(Inh);
}
@@ -1675,7 +1675,7 @@ TemplateDeclInstantiator::VisitCXXMethodDecl(CXXMethodDecl *D,
TemplateArgumentList::CreateCopy(SemaRef.Context,
Innermost.begin(),
Innermost.size()),
- /*InsertPos=*/0);
+ /*InsertPos=*/nullptr);
} else if (!isFriend) {
// Record that this is an instantiation of a member function.
Method->setInstantiationOfMemberFunction(D, TSK_ImplicitInstantiation);
@@ -1718,7 +1718,7 @@ TemplateDeclInstantiator::VisitCXXMethodDecl(CXXMethodDecl *D,
}
if (!IsClassScopeSpecialization)
- SemaRef.CheckFunctionDeclaration(0, Method, Previous, false);
+ SemaRef.CheckFunctionDeclaration(nullptr, Method, Previous, false);
if (D->isPure())
SemaRef.CheckPureMethod(Method, SourceRange());
@@ -1836,13 +1836,13 @@ Decl *TemplateDeclInstantiator::VisitNonTypeTemplateParmDecl(
D->getLocation(),
D->getDeclName());
if (!NewDI)
- return 0;
+ return nullptr;
ExpandedParameterPackTypesAsWritten.push_back(NewDI);
QualType NewT =SemaRef.CheckNonTypeTemplateParameterType(NewDI->getType(),
D->getLocation());
if (NewT.isNull())
- return 0;
+ return nullptr;
ExpandedParameterPackTypes.push_back(NewT);
}
@@ -1871,7 +1871,7 @@ Decl *TemplateDeclInstantiator::VisitNonTypeTemplateParmDecl(
TemplateArgs,
Expand, RetainExpansion,
NumExpansions))
- return 0;
+ return nullptr;
if (Expand) {
for (unsigned I = 0; I != *NumExpansions; ++I) {
@@ -1880,14 +1880,14 @@ Decl *TemplateDeclInstantiator::VisitNonTypeTemplateParmDecl(
D->getLocation(),
D->getDeclName());
if (!NewDI)
- return 0;
+ return nullptr;
ExpandedParameterPackTypesAsWritten.push_back(NewDI);
QualType NewT = SemaRef.CheckNonTypeTemplateParameterType(
NewDI->getType(),
D->getLocation());
if (NewT.isNull())
- return 0;
+ return nullptr;
ExpandedParameterPackTypes.push_back(NewT);
}
@@ -1905,12 +1905,12 @@ Decl *TemplateDeclInstantiator::VisitNonTypeTemplateParmDecl(
D->getLocation(),
D->getDeclName());
if (!NewPattern)
- return 0;
+ return nullptr;
DI = SemaRef.CheckPackExpansion(NewPattern, Expansion.getEllipsisLoc(),
NumExpansions);
if (!DI)
- return 0;
+ return nullptr;
T = DI->getType();
}
@@ -1919,7 +1919,7 @@ Decl *TemplateDeclInstantiator::VisitNonTypeTemplateParmDecl(
DI = SemaRef.SubstType(D->getTypeSourceInfo(), TemplateArgs,
D->getLocation(), D->getDeclName());
if (!DI)
- return 0;
+ return nullptr;
// Check that this type is acceptable for a non-type template parameter.
T = SemaRef.CheckNonTypeTemplateParameterType(DI->getType(),
@@ -2005,7 +2005,7 @@ TemplateDeclInstantiator::VisitTemplateTemplateParmDecl(
TemplateParameterList *Expansion =
SubstTemplateParams(D->getExpansionTemplateParameters(I));
if (!Expansion)
- return 0;
+ return nullptr;
ExpandedParams.push_back(Expansion);
}
@@ -2030,7 +2030,7 @@ TemplateDeclInstantiator::VisitTemplateTemplateParmDecl(
TemplateArgs,
Expand, RetainExpansion,
NumExpansions))
- return 0;
+ return nullptr;
if (Expand) {
for (unsigned I = 0; I != *NumExpansions; ++I) {
@@ -2038,7 +2038,7 @@ TemplateDeclInstantiator::VisitTemplateTemplateParmDecl(
LocalInstantiationScope Scope(SemaRef);
TemplateParameterList *Expansion = SubstTemplateParams(TempParams);
if (!Expansion)
- return 0;
+ return nullptr;
ExpandedParams.push_back(Expansion);
}
@@ -2055,7 +2055,7 @@ TemplateDeclInstantiator::VisitTemplateTemplateParmDecl(
LocalInstantiationScope Scope(SemaRef);
InstParams = SubstTemplateParams(TempParams);
if (!InstParams)
- return 0;
+ return nullptr;
}
} else {
// Perform the actual substitution of template parameters within a new,
@@ -2063,7 +2063,7 @@ TemplateDeclInstantiator::VisitTemplateTemplateParmDecl(
LocalInstantiationScope Scope(SemaRef);
InstParams = SubstTemplateParams(TempParams);
if (!InstParams)
- return 0;
+ return nullptr;
}
// Build the template template parameter.
@@ -2140,7 +2140,7 @@ Decl *TemplateDeclInstantiator::VisitUsingDecl(UsingDecl *D) {
= SemaRef.SubstNestedNameSpecifierLoc(D->getQualifierLoc(),
TemplateArgs);
if (!QualifierLoc)
- return 0;
+ return nullptr;
// The name info is non-dependent, so no transformation
// is required.
@@ -2200,9 +2200,9 @@ Decl *TemplateDeclInstantiator::VisitUsingDecl(UsingDecl *D) {
cast_or_null<NamedDecl>(SemaRef.FindInstantiatedDecl(
Shadow->getLocation(), Shadow->getTargetDecl(), TemplateArgs));
if (!InstTarget)
- return 0;
+ return nullptr;
- UsingShadowDecl *PrevDecl = 0;
+ UsingShadowDecl *PrevDecl = nullptr;
if (CheckRedeclaration) {
if (SemaRef.CheckUsingShadowDecl(NewUD, InstTarget, Prev, PrevDecl))
continue;
@@ -2212,7 +2212,8 @@ Decl *TemplateDeclInstantiator::VisitUsingDecl(UsingDecl *D) {
}
UsingShadowDecl *InstShadow =
- SemaRef.BuildUsingShadowDecl(/*Scope*/0, NewUD, InstTarget, PrevDecl);
+ SemaRef.BuildUsingShadowDecl(/*Scope*/nullptr, NewUD, InstTarget,
+ PrevDecl);
SemaRef.Context.setInstantiatedFromUsingShadowDecl(InstShadow, Shadow);
if (isFunctionScope)
@@ -2224,7 +2225,7 @@ Decl *TemplateDeclInstantiator::VisitUsingDecl(UsingDecl *D) {
Decl *TemplateDeclInstantiator::VisitUsingShadowDecl(UsingShadowDecl *D) {
// Ignore these; we handle them in bulk when processing the UsingDecl.
- return 0;
+ return nullptr;
}
Decl * TemplateDeclInstantiator
@@ -2233,7 +2234,7 @@ Decl * TemplateDeclInstantiator
= SemaRef.SubstNestedNameSpecifierLoc(D->getQualifierLoc(),
TemplateArgs);
if (!QualifierLoc)
- return 0;
+ return nullptr;
CXXScopeSpec SS;
SS.Adopt(QualifierLoc);
@@ -2242,8 +2243,8 @@ Decl * TemplateDeclInstantiator
// Hence, no transformation is required for it.
DeclarationNameInfo NameInfo(D->getDeclName(), D->getLocation());
NamedDecl *UD =
- SemaRef.BuildUsingDeclaration(/*Scope*/ 0, D->getAccess(),
- D->getUsingLoc(), SS, NameInfo, 0,
+ SemaRef.BuildUsingDeclaration(/*Scope*/ nullptr, D->getAccess(),
+ D->getUsingLoc(), SS, NameInfo, nullptr,
/*instantiation*/ true,
/*typename*/ true, D->getTypenameLoc());
if (UD)
@@ -2257,7 +2258,7 @@ Decl * TemplateDeclInstantiator
NestedNameSpecifierLoc QualifierLoc
= SemaRef.SubstNestedNameSpecifierLoc(D->getQualifierLoc(), TemplateArgs);
if (!QualifierLoc)
- return 0;
+ return nullptr;
CXXScopeSpec SS;
SS.Adopt(QualifierLoc);
@@ -2266,8 +2267,8 @@ Decl * TemplateDeclInstantiator
= SemaRef.SubstDeclarationNameInfo(D->getNameInfo(), TemplateArgs);
NamedDecl *UD =
- SemaRef.BuildUsingDeclaration(/*Scope*/ 0, D->getAccess(),
- D->getUsingLoc(), SS, NameInfo, 0,
+ SemaRef.BuildUsingDeclaration(/*Scope*/ nullptr, D->getAccess(),
+ D->getUsingLoc(), SS, NameInfo, nullptr,
/*instantiation*/ true,
/*typename*/ false, SourceLocation());
if (UD)
@@ -2281,13 +2282,13 @@ Decl *TemplateDeclInstantiator::VisitClassScopeFunctionSpecializationDecl(
ClassScopeFunctionSpecializationDecl *Decl) {
CXXMethodDecl *OldFD = Decl->getSpecialization();
CXXMethodDecl *NewFD = cast<CXXMethodDecl>(VisitCXXMethodDecl(OldFD,
- 0, true));
+ nullptr, true));
LookupResult Previous(SemaRef, NewFD->getNameInfo(), Sema::LookupOrdinaryName,
Sema::ForRedeclaration);
TemplateArgumentListInfo TemplateArgs;
- TemplateArgumentListInfo* TemplateArgsPtr = 0;
+ TemplateArgumentListInfo *TemplateArgsPtr = nullptr;
if (Decl->hasExplicitTemplateArgs()) {
TemplateArgs = Decl->templateArgs();
TemplateArgsPtr = &TemplateArgs;
@@ -2327,11 +2328,11 @@ Decl *TemplateDeclInstantiator::VisitOMPThreadPrivateDecl(
}
Decl *TemplateDeclInstantiator::VisitFunctionDecl(FunctionDecl *D) {
- return VisitFunctionDecl(D, 0);
+ return VisitFunctionDecl(D, nullptr);
}
Decl *TemplateDeclInstantiator::VisitCXXMethodDecl(CXXMethodDecl *D) {
- return VisitCXXMethodDecl(D, 0);
+ return VisitCXXMethodDecl(D, nullptr);
}
Decl *TemplateDeclInstantiator::VisitRecordDecl(RecordDecl *D) {
@@ -2354,11 +2355,11 @@ TemplateDeclInstantiator::VisitClassTemplateSpecializationDecl(
DeclContext::lookup_result Found
= Owner->lookup(ClassTemplate->getDeclName());
if (Found.empty())
- return 0;
+ return nullptr;
ClassTemplateDecl *InstClassTemplate
= dyn_cast<ClassTemplateDecl>(Found.front());
if (!InstClassTemplate)
- return 0;
+ return nullptr;
// Substitute into the template arguments of the class template explicit
// specialization.
@@ -2371,7 +2372,7 @@ TemplateDeclInstantiator::VisitClassTemplateSpecializationDecl(
ArgLocs.push_back(Loc.getArgLoc(I));
if (SemaRef.Subst(ArgLocs.data(), ArgLocs.size(),
InstTemplateArgs, TemplateArgs))
- return 0;
+ return nullptr;
// Check that the template argument list is well-formed for this
// class template.
@@ -2381,11 +2382,11 @@ TemplateDeclInstantiator::VisitClassTemplateSpecializationDecl(
InstTemplateArgs,
false,
Converted))
- return 0;
+ return nullptr;
// Figure out where to insert this class template explicit specialization
// in the member template's set of class template explicit specializations.
- void *InsertPos = 0;
+ void *InsertPos = nullptr;
ClassTemplateSpecializationDecl *PrevDecl =
InstClassTemplate->findSpecialization(Converted.data(), Converted.size(),
InsertPos);
@@ -2400,7 +2401,7 @@ TemplateDeclInstantiator::VisitClassTemplateSpecializationDecl(
PrevDecl->getSpecializationKind(),
PrevDecl->getPointOfInstantiation(),
Ignored))
- return 0;
+ return nullptr;
// If PrevDecl was a definition and D is also a definition, diagnose.
// This happens in cases like:
@@ -2419,7 +2420,7 @@ TemplateDeclInstantiator::VisitClassTemplateSpecializationDecl(
SemaRef.Diag(D->getLocation(), diag::err_redefinition) << PrevDecl;
SemaRef.Diag(PrevDecl->getDefinition()->getLocation(),
diag::note_previous_definition);
- return 0;
+ return nullptr;
}
// Create the class template partial specialization declaration.
@@ -2441,7 +2442,7 @@ TemplateDeclInstantiator::VisitClassTemplateSpecializationDecl(
// Substitute the nested name specifier, if any.
if (SubstQualifier(D, InstD))
- return 0;
+ return nullptr;
// Build the canonical type that describes the converted template
// arguments of the class template explicit specialization.
@@ -2476,7 +2477,7 @@ TemplateDeclInstantiator::VisitClassTemplateSpecializationDecl(
SemaRef.InstantiateClass(D->getLocation(), InstD, D, TemplateArgs,
TSK_ImplicitInstantiation,
/*Complain=*/true))
- return 0;
+ return nullptr;
return InstD;
}
@@ -2496,7 +2497,7 @@ Decl *TemplateDeclInstantiator::VisitVarTemplateSpecializationDecl(
if (SemaRef.Subst(TemplateArgsInfo.getArgumentArray(),
TemplateArgsInfo.size(), VarTemplateArgsInfo, TemplateArgs))
- return 0;
+ return nullptr;
// Check that the template argument list is well-formed for this template.
SmallVector<TemplateArgument, 4> Converted;
@@ -2504,11 +2505,11 @@ Decl *TemplateDeclInstantiator::VisitVarTemplateSpecializationDecl(
VarTemplate, VarTemplate->getLocStart(),
const_cast<TemplateArgumentListInfo &>(VarTemplateArgsInfo), false,
Converted))
- return 0;
+ return nullptr;
// Find the variable template specialization declaration that
// corresponds to these arguments.
- void *InsertPos = 0;
+ void *InsertPos = nullptr;
if (VarTemplateSpecializationDecl *VarSpec = VarTemplate->findSpecialization(
Converted.data(), Converted.size(), InsertPos))
// If we already have a variable template specialization, return it.
@@ -2528,19 +2529,19 @@ Decl *TemplateDeclInstantiator::VisitVarTemplateSpecializationDecl(
if (const RecordType *RecordTy = D->getType()->getAs<RecordType>())
if (RecordTy->getDecl()->isAnonymousStructOrUnion())
if (!VisitCXXRecordDecl(cast<CXXRecordDecl>(RecordTy->getDecl())))
- return 0;
+ return nullptr;
// Do substitution on the type of the declaration
TypeSourceInfo *DI =
SemaRef.SubstType(D->getTypeSourceInfo(), TemplateArgs,
D->getTypeSpecStartLoc(), D->getDeclName());
if (!DI)
- return 0;
+ return nullptr;
if (DI->getType()->isFunctionType()) {
SemaRef.Diag(D->getLocation(), diag::err_variable_instantiates_to_function)
<< D->isStaticDataMember() << DI->getType();
- return 0;
+ return nullptr;
}
// Build the instantiated declaration
@@ -2554,7 +2555,7 @@ Decl *TemplateDeclInstantiator::VisitVarTemplateSpecializationDecl(
// Substitute the nested name specifier, if any.
if (SubstQualifier(D, Var))
- return 0;
+ return nullptr;
SemaRef.BuildVariableInstantiation(Var, D, TemplateArgs, LateAttrs,
Owner, StartingScope);
@@ -2574,7 +2575,7 @@ Decl *TemplateDeclInstantiator::VisitFriendTemplateDecl(FriendTemplateDecl *D) {
SemaRef.Diag(D->getLocation(), DiagID)
<< D->getDeclKindName();
- return 0;
+ return nullptr;
}
Decl *TemplateDeclInstantiator::VisitDecl(Decl *D) {
@@ -2585,7 +2586,7 @@ Decl *Sema::SubstDecl(Decl *D, DeclContext *Owner,
const MultiLevelTemplateArgumentList &TemplateArgs) {
TemplateDeclInstantiator Instantiator(*this, Owner, TemplateArgs);
if (D->isInvalidDecl())
- return 0;
+ return nullptr;
return Instantiator.Visit(D);
}
@@ -2614,7 +2615,7 @@ TemplateDeclInstantiator::SubstTemplateParams(TemplateParameterList *L) {
// Clean up if we had an error.
if (Invalid)
- return NULL;
+ return nullptr;
TemplateParameterList *InstL
= TemplateParameterList::Create(SemaRef.Context, L->getTemplateLoc(),
@@ -2648,7 +2649,7 @@ TemplateDeclInstantiator::InstantiateClassTemplatePartialSpecialization(
TemplateParameterList *TempParams = PartialSpec->getTemplateParameters();
TemplateParameterList *InstParams = SubstTemplateParams(TempParams);
if (!InstParams)
- return 0;
+ return nullptr;
// Substitute into the template arguments of the class template partial
// specialization.
@@ -2659,7 +2660,7 @@ TemplateDeclInstantiator::InstantiateClassTemplatePartialSpecialization(
if (SemaRef.Subst(TemplArgInfo->getTemplateArgs(),
TemplArgInfo->NumTemplateArgs,
InstTemplateArgs, TemplateArgs))
- return 0;
+ return nullptr;
// Check that the template argument list is well-formed for this
// class template.
@@ -2669,11 +2670,11 @@ TemplateDeclInstantiator::InstantiateClassTemplatePartialSpecialization(
InstTemplateArgs,
false,
Converted))
- return 0;
+ return nullptr;
// Figure out where to insert this class template partial specialization
// in the member template's set of class template partial specializations.
- void *InsertPos = 0;
+ void *InsertPos = nullptr;
ClassTemplateSpecializationDecl *PrevDecl
= ClassTemplate->findPartialSpecialization(Converted.data(),
Converted.size(), InsertPos);
@@ -2719,7 +2720,7 @@ TemplateDeclInstantiator::InstantiateClassTemplatePartialSpecialization(
<< WrittenTy->getType();
SemaRef.Diag(PrevDecl->getLocation(), diag::note_prev_partial_spec_here)
<< SemaRef.Context.getTypeDeclType(PrevDecl);
- return 0;
+ return nullptr;
}
@@ -2736,17 +2737,18 @@ TemplateDeclInstantiator::InstantiateClassTemplatePartialSpecialization(
Converted.size(),
InstTemplateArgs,
CanonType,
- 0);
+ nullptr);
// Substitute the nested name specifier, if any.
if (SubstQualifier(PartialSpec, InstPartialSpec))
- return 0;
+ return nullptr;
InstPartialSpec->setInstantiatedFromMember(PartialSpec);
InstPartialSpec->setTypeAsWritten(WrittenTy);
// Add this partial specialization to the set of class template partial
// specializations.
- ClassTemplate->AddPartialSpecialization(InstPartialSpec, /*InsertPos=*/0);
+ ClassTemplate->AddPartialSpecialization(InstPartialSpec,
+ /*InsertPos=*/nullptr);
return InstPartialSpec;
}
@@ -2775,7 +2777,7 @@ TemplateDeclInstantiator::InstantiateVarTemplatePartialSpecialization(
TemplateParameterList *TempParams = PartialSpec->getTemplateParameters();
TemplateParameterList *InstParams = SubstTemplateParams(TempParams);
if (!InstParams)
- return 0;
+ return nullptr;
// Substitute into the template arguments of the variable template partial
// specialization.
@@ -2786,18 +2788,18 @@ TemplateDeclInstantiator::InstantiateVarTemplatePartialSpecialization(
if (SemaRef.Subst(TemplArgInfo->getTemplateArgs(),
TemplArgInfo->NumTemplateArgs,
InstTemplateArgs, TemplateArgs))
- return 0;
+ return nullptr;
// Check that the template argument list is well-formed for this
// class template.
SmallVector<TemplateArgument, 4> Converted;
if (SemaRef.CheckTemplateArgumentList(VarTemplate, PartialSpec->getLocation(),
InstTemplateArgs, false, Converted))
- return 0;
+ return nullptr;
// Figure out where to insert this variable template partial specialization
// in the member template's set of variable template partial specializations.
- void *InsertPos = 0;
+ void *InsertPos = nullptr;
VarTemplateSpecializationDecl *PrevDecl =
VarTemplate->findPartialSpecialization(Converted.data(), Converted.size(),
InsertPos);
@@ -2839,7 +2841,7 @@ TemplateDeclInstantiator::InstantiateVarTemplatePartialSpecialization(
<< WrittenTy->getType();
SemaRef.Diag(PrevDecl->getLocation(),
diag::note_var_prev_partial_spec_here);
- return 0;
+ return nullptr;
}
// Do substitution on the type of the declaration
@@ -2847,13 +2849,13 @@ TemplateDeclInstantiator::InstantiateVarTemplatePartialSpecialization(
PartialSpec->getTypeSourceInfo(), TemplateArgs,
PartialSpec->getTypeSpecStartLoc(), PartialSpec->getDeclName());
if (!DI)
- return 0;
+ return nullptr;
if (DI->getType()->isFunctionType()) {
SemaRef.Diag(PartialSpec->getLocation(),
diag::err_variable_instantiates_to_function)
<< PartialSpec->isStaticDataMember() << DI->getType();
- return 0;
+ return nullptr;
}
// Create the variable template partial specialization declaration.
@@ -2866,14 +2868,14 @@ TemplateDeclInstantiator::InstantiateVarTemplatePartialSpecialization(
// Substitute the nested name specifier, if any.
if (SubstQualifier(PartialSpec, InstPartialSpec))
- return 0;
+ return nullptr;
InstPartialSpec->setInstantiatedFromMember(PartialSpec);
InstPartialSpec->setTypeAsWritten(WrittenTy);
// Add this partial specialization to the set of variable template partial
// specializations. The instantiation of the initializer is not necessary.
- VarTemplate->AddPartialSpecialization(InstPartialSpec, /*InsertPos=*/0);
+ VarTemplate->AddPartialSpecialization(InstPartialSpec, /*InsertPos=*/nullptr);
SemaRef.BuildVariableInstantiation(InstPartialSpec, PartialSpec, TemplateArgs,
LateAttrs, Owner, StartingScope);
@@ -2887,8 +2889,8 @@ TemplateDeclInstantiator::SubstFunctionType(FunctionDecl *D,
TypeSourceInfo *OldTInfo = D->getTypeSourceInfo();
assert(OldTInfo && "substituting function without type source info");
assert(Params.empty() && "parameter vector is non-empty at start");
-
- CXXRecordDecl *ThisContext = 0;
+
+ CXXRecordDecl *ThisContext = nullptr;
unsigned ThisTypeQuals = 0;
if (CXXMethodDecl *Method = dyn_cast<CXXMethodDecl>(D)) {
ThisContext = cast<CXXRecordDecl>(Owner);
@@ -2901,7 +2903,7 @@ TemplateDeclInstantiator::SubstFunctionType(FunctionDecl *D,
D->getDeclName(),
ThisContext, ThisTypeQuals);
if (!NewTInfo)
- return 0;
+ return nullptr;
TypeLoc OldTL = OldTInfo->getTypeLoc().IgnoreParens();
if (FunctionProtoTypeLoc OldProtoLoc = OldTL.getAs<FunctionProtoTypeLoc>()) {
@@ -2954,7 +2956,7 @@ TemplateDeclInstantiator::SubstFunctionType(FunctionDecl *D,
ParmVarDecl *Parm =
cast_or_null<ParmVarDecl>(VisitParmVarDecl(OldParam));
if (!Parm)
- return 0;
+ return nullptr;
Params.push_back(Parm);
}
}
@@ -2973,7 +2975,7 @@ TemplateDeclInstantiator::SubstFunctionType(FunctionDecl *D,
if (SemaRef.SubstParmTypes(D->getLocation(), D->param_begin(),
D->getNumParams(), TemplateArgs, ParamTypes,
&Params))
- return 0;
+ return nullptr;
}
return NewTInfo;
@@ -3036,7 +3038,7 @@ static void InstantiateExceptionSpec(Sema &SemaRef, FunctionDecl *New,
// "pointer to cv-qualifier-seq X" between the optional cv-qualifer-seq
// and the end of the function-definition, member-declarator, or
// declarator.
- CXXRecordDecl *ThisContext = 0;
+ CXXRecordDecl *ThisContext = nullptr;
unsigned ThisTypeQuals = 0;
if (CXXMethodDecl *Method = dyn_cast<CXXMethodDecl>(New)) {
ThisContext = Method->getParent();
@@ -3118,7 +3120,7 @@ static void InstantiateExceptionSpec(Sema &SemaRef, FunctionDecl *New,
Exceptions.push_back(T);
}
- Expr *NoexceptExpr = 0;
+ Expr *NoexceptExpr = nullptr;
if (Expr *OldNoexceptExpr = Proto->getNoexceptExpr()) {
EnterExpressionEvaluationContext Unevaluated(SemaRef,
Sema::ConstantEvaluated);
@@ -3132,7 +3134,7 @@ static void InstantiateExceptionSpec(Sema &SemaRef, FunctionDecl *New,
!NoexceptExpr->isValueDependent())
NoexceptExpr
= SemaRef.VerifyIntegerConstantExpression(NoexceptExpr,
- 0, diag::err_noexcept_needs_constant_expression,
+ nullptr, diag::err_noexcept_needs_constant_expression,
/*AllowFold*/ false).take();
}
}
@@ -3169,7 +3171,7 @@ void Sema::InstantiateExceptionSpec(SourceLocation PointOfInstantiation,
LocalInstantiationScope Scope(*this);
MultiLevelTemplateArgumentList TemplateArgs =
- getTemplateInstantiationArgs(Decl, 0, /*RelativeToPrimary*/true);
+ getTemplateInstantiationArgs(Decl, nullptr, /*RelativeToPrimary*/true);
FunctionDecl *Template = Proto->getExceptionSpecTemplate();
addInstantiatedParametersToScope(*this, Decl, Template, Scope, TemplateArgs);
@@ -3415,14 +3417,14 @@ void Sema::InstantiateFunctionDefinition(SourceLocation PointOfInstantiation,
if (PatternDecl->isDefaulted())
SetDeclDefaulted(Function, PatternDecl->getLocation());
else {
- ActOnStartOfFunctionDef(0, Function);
+ ActOnStartOfFunctionDef(nullptr, Function);
// Enter the scope of this instantiation. We don't use
// PushDeclContext because we don't have a scope.
Sema::ContextRAII savedContext(*this, Function);
MultiLevelTemplateArgumentList TemplateArgs =
- getTemplateInstantiationArgs(Function, 0, false, PatternDecl);
+ getTemplateInstantiationArgs(Function, nullptr, false, PatternDecl);
addInstantiatedParametersToScope(*this, Function, PatternDecl, Scope,
TemplateArgs);
@@ -3488,11 +3490,11 @@ VarTemplateSpecializationDecl *Sema::BuildVarTemplateInstantiation(
LateInstantiatedAttrVec *LateAttrs,
LocalInstantiationScope *StartingScope) {
if (FromVar->isInvalidDecl())
- return 0;
+ return nullptr;
InstantiatingTemplate Inst(*this, PointOfInstantiation, FromVar);
if (Inst.isInvalid())
- return 0;
+ return nullptr;
MultiLevelTemplateArgumentList TemplateArgLists;
TemplateArgLists.addOuterTemplateArguments(&TemplateArgList);
@@ -3537,7 +3539,7 @@ VarTemplateSpecializationDecl *Sema::CompleteVarTemplateSpecializationDecl(
SubstType(PatternDecl->getTypeSourceInfo(), TemplateArgs,
PatternDecl->getTypeSpecStartLoc(), PatternDecl->getDeclName());
if (!DI)
- return 0;
+ return nullptr;
// Update the type of this variable template specialization.
VarSpec->setType(DI->getType());
@@ -3725,7 +3727,7 @@ void Sema::InstantiateVariableDefinition(SourceLocation PointOfInstantiation,
VarTemplateSpecializationDecl *VarSpec =
dyn_cast<VarTemplateSpecializationDecl>(Var);
- VarDecl *PatternDecl = 0, *Def = 0;
+ VarDecl *PatternDecl = nullptr, *Def = nullptr;
MultiLevelTemplateArgumentList TemplateArgs =
getTemplateInstantiationArgs(Var);
@@ -3935,7 +3937,7 @@ void Sema::InstantiateVariableDefinition(SourceLocation PointOfInstantiation,
TemplateDeclInstantiator Instantiator(*this, Var->getDeclContext(),
TemplateArgs);
Var = cast_or_null<VarDecl>(Instantiator.VisitVarTemplateSpecializationDecl(
- VarSpec->getSpecializedTemplate(), Def, 0,
+ VarSpec->getSpecializedTemplate(), Def, nullptr,
VarSpec->getTemplateArgsInfo(), VarSpec->getTemplateArgs().asArray()));
if (Var) {
llvm::PointerUnion<VarTemplateDecl *,
@@ -4335,7 +4337,7 @@ static NamedDecl *findInstantiationOf(ASTContext &Ctx,
if (isInstantiationOf(Ctx, D, *first))
return cast<NamedDecl>(*first);
- return 0;
+ return nullptr;
}
/// \brief Finds the instantiation of the given declaration context
@@ -4425,7 +4427,7 @@ NamedDecl *Sema::FindInstantiatedDecl(SourceLocation Loc, NamedDecl *D,
return D;
if (D->isInvalidDecl())
- return 0;
+ return nullptr;
// If we didn't find the decl, then we must have a label decl that hasn't
// been found yet. Lazily instantiate it and return it now.
@@ -4509,7 +4511,7 @@ NamedDecl *Sema::FindInstantiatedDecl(SourceLocation Loc, NamedDecl *D,
ParentDC = FindInstantiatedContext(Loc, ParentDC, TemplateArgs);
if (!ParentDC)
- return 0;
+ return nullptr;
if (ParentDC != D->getDeclContext()) {
// We performed some kind of instantiation in the parent context,
@@ -4528,13 +4530,13 @@ NamedDecl *Sema::FindInstantiatedDecl(SourceLocation Loc, NamedDecl *D,
IsBeingInstantiated = true;
if (!Tag->isBeingDefined() &&
RequireCompleteType(Loc, T, diag::err_incomplete_type))
- return 0;
+ return nullptr;
ParentDC = Tag->getDecl();
}
}
- NamedDecl *Result = 0;
+ NamedDecl *Result = nullptr;
if (D->getDeclName()) {
DeclContext::lookup_result Found = ParentDC->lookup(D->getDeclName());
Result = findInstantiationOf(Context, D, Found.begin(), Found.end());
OpenPOWER on IntegriCloud