summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaDeclCXX.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib/Sema/SemaDeclCXX.cpp')
-rw-r--r--clang/lib/Sema/SemaDeclCXX.cpp359
1 files changed, 183 insertions, 176 deletions
diff --git a/clang/lib/Sema/SemaDeclCXX.cpp b/clang/lib/Sema/SemaDeclCXX.cpp
index 2930d307528..2f9f9824fef 100644
--- a/clang/lib/Sema/SemaDeclCXX.cpp
+++ b/clang/lib/Sema/SemaDeclCXX.cpp
@@ -386,11 +386,11 @@ void Sema::CheckExtraCXXDefaultArguments(Declarator &D) {
<< SourceRange((*Toks)[1].getLocation(),
Toks->back().getLocation());
delete Toks;
- chunk.Fun.Params[argIdx].DefaultArgTokens = 0;
+ chunk.Fun.Params[argIdx].DefaultArgTokens = nullptr;
} else if (Param->getDefaultArg()) {
Diag(Param->getLocation(), diag::err_param_default_argument_nonfunc)
<< Param->getDefaultArg()->getSourceRange();
- Param->setDefaultArg(0);
+ Param->setDefaultArg(nullptr);
}
}
} else if (chunk.Kind != DeclaratorChunk::Paren) {
@@ -706,7 +706,7 @@ void Sema::CheckCXXDefaultArguments(FunctionDecl *FD) {
for (p = 0; p <= LastMissingDefaultArg; ++p) {
ParmVarDecl *Param = FD->getParamDecl(p);
if (Param->hasDefaultArg()) {
- Param->setDefaultArg(0);
+ Param->setDefaultArg(nullptr);
}
}
}
@@ -1313,7 +1313,7 @@ Sema::CheckBaseSpecifier(CXXRecordDecl *Class,
if (Class->isUnion()) {
Diag(Class->getLocation(), diag::err_base_clause_on_union)
<< SpecifierRange;
- return 0;
+ return nullptr;
}
if (EllipsisLoc.isValid() &&
@@ -1339,8 +1339,8 @@ Sema::CheckBaseSpecifier(CXXRecordDecl *Class,
if (BaseDecl->getCanonicalDecl() != Class->getCanonicalDecl())
Diag(BaseDecl->getLocation(), diag::note_previous_decl)
<< BaseType;
-
- return 0;
+
+ return nullptr;
}
}
@@ -1352,14 +1352,14 @@ Sema::CheckBaseSpecifier(CXXRecordDecl *Class,
// Base specifiers must be record types.
if (!BaseType->isRecordType()) {
Diag(BaseLoc, diag::err_base_must_be_class) << SpecifierRange;
- return 0;
+ return nullptr;
}
// C++ [class.union]p1:
// A union shall not be used as a base class.
if (BaseType->isUnionType()) {
Diag(BaseLoc, diag::err_union_as_base_class) << SpecifierRange;
- return 0;
+ return nullptr;
}
// C++ [class.derived]p2:
@@ -1368,7 +1368,7 @@ Sema::CheckBaseSpecifier(CXXRecordDecl *Class,
if (RequireCompleteType(BaseLoc, BaseType,
diag::err_incomplete_base_class, SpecifierRange)) {
Class->setInvalidDecl();
- return 0;
+ return nullptr;
}
// If the base class is polymorphic or isn't empty, the new one is/isn't, too.
@@ -1388,7 +1388,7 @@ Sema::CheckBaseSpecifier(CXXRecordDecl *Class,
if (CXXBaseDecl->hasFlexibleArrayMember()) {
Diag(BaseLoc, diag::err_base_class_has_flexible_array_member)
<< CXXBaseDecl->getDeclName();
- return 0;
+ return nullptr;
}
// C++ [class]p3:
@@ -1400,7 +1400,7 @@ Sema::CheckBaseSpecifier(CXXRecordDecl *Class,
<< FA->isSpelledAsSealed();
Diag(CXXBaseDecl->getLocation(), diag::note_previous_decl)
<< CXXBaseDecl->getDeclName();
- return 0;
+ return nullptr;
}
if (BaseDecl->isInvalidDecl())
@@ -1447,7 +1447,7 @@ Sema::ActOnBaseSpecifier(Decl *classdecl, SourceRange SpecifierRange,
}
}
- TypeSourceInfo *TInfo = 0;
+ TypeSourceInfo *TInfo = nullptr;
GetTypeFromParser(basetype, &TInfo);
if (EllipsisLoc.isInvalid() &&
@@ -1850,10 +1850,10 @@ static bool InitializationHasSideEffects(const FieldDecl &FD) {
}
static AttributeList *getMSPropertyAttr(AttributeList *list) {
- for (AttributeList* it = list; it != 0; it = it->getNext())
+ for (AttributeList *it = list; it != nullptr; it = it->getNext())
if (it->isDeclspecPropertyAttribute())
return it;
- return 0;
+ return nullptr;
}
/// ActOnCXXMemberDeclarator - This is invoked when a C++ class member
@@ -1922,7 +1922,7 @@ Sema::ActOnCXXMemberDeclarator(Scope *S, AccessSpecifier AS, Declarator &D,
else
Diag(Loc, diag::err_invalid_member_in_interface)
<< (InvalidDecl-1) << "";
- return 0;
+ return nullptr;
}
}
@@ -1999,7 +1999,7 @@ Sema::ActOnCXXMemberDeclarator(Scope *S, AccessSpecifier AS, Declarator &D,
if (!Name.isIdentifier()) {
Diag(Loc, diag::err_bad_variable_name)
<< Name;
- return 0;
+ return nullptr;
}
IdentifierInfo *II = Name.getAsIdentifierInfo();
@@ -2022,7 +2022,7 @@ Sema::ActOnCXXMemberDeclarator(Scope *S, AccessSpecifier AS, Declarator &D,
<< SourceRange(TemplateParams->getTemplateLoc(),
TemplateParams->getRAngleLoc());
}
- return 0;
+ return nullptr;
}
if (SS.isSet() && !SS.isInvalid()) {
@@ -2047,7 +2047,7 @@ Sema::ActOnCXXMemberDeclarator(Scope *S, AccessSpecifier AS, Declarator &D,
Member = HandleMSProperty(S, cast<CXXRecordDecl>(CurContext), Loc, D,
BitWidth, InitStyle, AS, MSPropertyAttr);
if (!Member)
- return 0;
+ return nullptr;
isInstField = false;
} else {
Member = HandleField(S, cast<CXXRecordDecl>(CurContext), Loc, D,
@@ -2059,7 +2059,7 @@ Sema::ActOnCXXMemberDeclarator(Scope *S, AccessSpecifier AS, Declarator &D,
Member = HandleDeclarator(S, D, TemplateParameterLists);
if (!Member)
- return 0;
+ return nullptr;
// Non-instance-fields can't have a bitfield.
if (BitWidth) {
@@ -2082,7 +2082,7 @@ Sema::ActOnCXXMemberDeclarator(Scope *S, AccessSpecifier AS, Declarator &D,
<< BitWidth->getSourceRange();
}
- BitWidth = 0;
+ BitWidth = nullptr;
Member->setInvalidDecl();
}
@@ -2293,7 +2293,7 @@ namespace {
// In class initializers will point to the constructor.
UninitializedFieldVisitor(S, Decls, Constructor).Visit(E);
} else {
- UninitializedFieldVisitor(S, Decls, 0).Visit(E);
+ UninitializedFieldVisitor(S, Decls, nullptr).Visit(E);
}
}
@@ -2357,7 +2357,7 @@ void Sema::ActOnFinishCXXInClassMemberInitializer(Decl *D,
SourceLocation InitLoc,
Expr *InitExpr) {
// Pop the notional constructor scope we created earlier.
- PopFunctionScopeInfo(0, D);
+ PopFunctionScopeInfo(nullptr, D);
FieldDecl *FD = cast<FieldDecl>(D);
assert(FD->getInClassInitStyle() != ICIS_NoInit &&
@@ -2412,7 +2412,7 @@ static bool FindBaseInitializer(Sema &SemaRef,
const CXXBaseSpecifier *&DirectBaseSpec,
const CXXBaseSpecifier *&VirtualBaseSpec) {
// First, check for a direct base class.
- DirectBaseSpec = 0;
+ DirectBaseSpec = nullptr;
for (const auto &Base : ClassDecl->bases()) {
if (SemaRef.Context.hasSameUnqualifiedType(BaseType, Base.getType())) {
// We found a direct base of this type. That's what we're
@@ -2425,7 +2425,7 @@ static bool FindBaseInitializer(Sema &SemaRef,
// Check for a virtual base class.
// FIXME: We might be able to short-circuit this if we know in advance that
// there are no virtual bases.
- VirtualBaseSpec = 0;
+ VirtualBaseSpec = nullptr;
if (!DirectBaseSpec || !DirectBaseSpec->isVirtual()) {
// We haven't found a base yet; search the class hierarchy for a
// virtual base class.
@@ -2562,7 +2562,7 @@ Sema::BuildMemInitializer(Decl *ConstructorD,
}
// It didn't name a member, so see if it names a class.
QualType BaseType;
- TypeSourceInfo *TInfo = 0;
+ TypeSourceInfo *TInfo = nullptr;
if (TemplateTypeTy) {
BaseType = GetTypeFromParser(TemplateTypeTy, &TInfo);
@@ -2747,15 +2747,17 @@ Sema::BuildMemberInitializer(ValueDecl *Member, Expr *Init,
// Initialize the member.
InitializedEntity MemberEntity =
- DirectMember ? InitializedEntity::InitializeMember(DirectMember, 0)
- : InitializedEntity::InitializeMember(IndirectMember, 0);
+ DirectMember ? InitializedEntity::InitializeMember(DirectMember, nullptr)
+ : InitializedEntity::InitializeMember(IndirectMember,
+ nullptr);
InitializationKind Kind =
InitList ? InitializationKind::CreateDirectList(IdLoc)
: InitializationKind::CreateDirect(IdLoc, InitRange.getBegin(),
InitRange.getEnd());
InitializationSequence InitSeq(*this, MemberEntity, Kind, Args);
- ExprResult MemberInit = InitSeq.Perform(*this, MemberEntity, Kind, Args, 0);
+ ExprResult MemberInit = InitSeq.Perform(*this, MemberEntity, Kind, Args,
+ nullptr);
if (MemberInit.isInvalid())
return true;
@@ -2808,7 +2810,7 @@ Sema::BuildDelegatingInitializer(TypeSourceInfo *TInfo, Expr *Init,
InitRange.getEnd());
InitializationSequence InitSeq(*this, DelegationEntity, Kind, Args);
ExprResult DelegationInit = InitSeq.Perform(*this, DelegationEntity, Kind,
- Args, 0);
+ Args, nullptr);
if (DelegationInit.isInvalid())
return true;
@@ -2876,8 +2878,8 @@ Sema::BuildBaseInitializer(QualType BaseType, TypeSourceInfo *BaseTInfo,
}
// Check for direct and virtual base classes.
- const CXXBaseSpecifier *DirectBaseSpec = 0;
- const CXXBaseSpecifier *VirtualBaseSpec = 0;
+ const CXXBaseSpecifier *DirectBaseSpec = nullptr;
+ const CXXBaseSpecifier *VirtualBaseSpec = nullptr;
if (!Dependent) {
if (Context.hasSameUnqualifiedType(QualType(ClassDecl->getTypeForDecl(),0),
BaseType))
@@ -2941,7 +2943,7 @@ Sema::BuildBaseInitializer(QualType BaseType, TypeSourceInfo *BaseTInfo,
: InitializationKind::CreateDirect(BaseLoc, InitRange.getBegin(),
InitRange.getEnd());
InitializationSequence InitSeq(*this, BaseEntity, Kind, Args);
- ExprResult BaseInit = InitSeq.Perform(*this, BaseEntity, Kind, Args, 0);
+ ExprResult BaseInit = InitSeq.Perform(*this, BaseEntity, Kind, Args, nullptr);
if (BaseInit.isInvalid())
return true;
@@ -3051,7 +3053,7 @@ BuildImplicitBaseInitializer(Sema &SemaRef, CXXConstructorDecl *Constructor,
DeclRefExpr::Create(SemaRef.Context, NestedNameSpecifierLoc(),
SourceLocation(), Param, false,
Constructor->getLocation(), ParamType,
- VK_LValue, 0);
+ VK_LValue, nullptr);
SemaRef.MarkDeclRefReferenced(cast<DeclRefExpr>(CopyCtorArg));
@@ -3124,7 +3126,7 @@ BuildImplicitMemberInitializer(Sema &SemaRef, CXXConstructorDecl *Constructor,
Expr *MemberExprBase =
DeclRefExpr::Create(SemaRef.Context, NestedNameSpecifierLoc(),
SourceLocation(), Param, false,
- Loc, ParamType, VK_LValue, 0);
+ Loc, ParamType, VK_LValue, nullptr);
SemaRef.MarkDeclRefReferenced(cast<DeclRefExpr>(MemberExprBase));
@@ -3145,9 +3147,9 @@ BuildImplicitMemberInitializer(Sema &SemaRef, CXXConstructorDecl *Constructor,
/*IsArrow=*/false,
SS,
/*TemplateKWLoc=*/SourceLocation(),
- /*FirstQualifierInScope=*/0,
+ /*FirstQualifierInScope=*/nullptr,
MemberLookup,
- /*TemplateArgs=*/0);
+ /*TemplateArgs=*/nullptr);
if (CtorArg.isInvalid())
return true;
@@ -3170,7 +3172,7 @@ BuildImplicitMemberInitializer(Sema &SemaRef, CXXConstructorDecl *Constructor,
= SemaRef.Context.getAsConstantArrayType(BaseType)) {
InitializingArray = true;
// Create the iteration variable for this array index.
- IdentifierInfo *IterationVarName = 0;
+ IdentifierInfo *IterationVarName = nullptr;
{
SmallString<8> Str;
llvm::raw_svector_ostream OS(Str);
@@ -3324,7 +3326,7 @@ BuildImplicitMemberInitializer(Sema &SemaRef, CXXConstructorDecl *Constructor,
}
// Nothing to initialize.
- CXXMemberInit = 0;
+ CXXMemberInit = nullptr;
return false;
}
@@ -3436,7 +3438,7 @@ static bool isIncompleteOrZeroLengthArrayType(ASTContext &Context, QualType T) {
static bool CollectFieldInitializer(Sema &SemaRef, BaseAndFieldInfo &Info,
FieldDecl *Field,
- IndirectFieldDecl *Indirect = 0) {
+ IndirectFieldDecl *Indirect = nullptr) {
if (Field->isInvalidDecl())
return false;
@@ -3487,7 +3489,7 @@ static bool CollectFieldInitializer(Sema &SemaRef, BaseAndFieldInfo &Info,
if (Info.AnyErrorsInInits)
return false;
- CXXCtorInitializer *Init = 0;
+ CXXCtorInitializer *Init = nullptr;
if (BuildImplicitMemberInitializer(Info.S, Info.Ctor, Info.IIK, Field,
Indirect, Init))
return true;
@@ -3768,7 +3770,7 @@ static void DiagnoseBaseOrMemInitializerOrder(
unsigned NumIdealInits = IdealInitKeys.size();
unsigned IdealIndex = 0;
- CXXCtorInitializer *PrevInit = 0;
+ CXXCtorInitializer *PrevInit = nullptr;
for (unsigned InitIndex = 0; InitIndex != Inits.size(); ++InitIndex) {
CXXCtorInitializer *Init = Inits[InitIndex];
const void *InitKey = GetKeyForMember(SemaRef.Context, Init);
@@ -4050,7 +4052,7 @@ Sema::MarkBaseAndMemberDestructorsReferenced(SourceLocation Location,
CheckDerivedToBaseConversion(
Context.getTypeDeclType(ClassDecl), VBase.getType(),
diag::err_access_dtor_vbase, 0, ClassDecl->getLocation(),
- SourceRange(), DeclarationName(), 0);
+ SourceRange(), DeclarationName(), nullptr);
}
MarkFunctionReferenced(Location, Dtor);
@@ -5272,7 +5274,7 @@ bool Sema::ShouldDeleteSpecialMember(CXXMethodDecl *MD, CXXSpecialMember CSM,
// operator is defined as deleted.
if (MD->isImplicit() &&
(CSM == CXXCopyConstructor || CSM == CXXCopyAssignment)) {
- CXXMethodDecl *UserDeclaredMove = 0;
+ CXXMethodDecl *UserDeclaredMove = nullptr;
// In Microsoft mode, a user-declared move only causes the deletion of the
// corresponding copy operation, not both copy operations.
@@ -5318,7 +5320,7 @@ bool Sema::ShouldDeleteSpecialMember(CXXMethodDecl *MD, CXXSpecialMember CSM,
// -- for a virtual destructor, lookup of the non-array deallocation function
// results in an ambiguity or in a function that is deleted or inaccessible
if (CSM == CXXDestructor && MD->isVirtual()) {
- FunctionDecl *OperatorDelete = 0;
+ FunctionDecl *OperatorDelete = nullptr;
DeclarationName Name =
Context.DeclarationNames.getCXXOperatorName(OO_Delete);
if (FindDeallocationFunction(MD->getLocation(), MD->getParent(), Name,
@@ -5367,7 +5369,7 @@ static bool findTrivialSpecialMember(Sema &S, CXXRecordDecl *RD,
Sema::CXXSpecialMember CSM, unsigned Quals,
bool ConstRHS, CXXMethodDecl **Selected) {
if (Selected)
- *Selected = 0;
+ *Selected = nullptr;
switch (CSM) {
case Sema::CXXInvalid:
@@ -5386,7 +5388,7 @@ static bool findTrivialSpecialMember(Sema &S, CXXRecordDecl *RD,
// If there's a default constructor which could have been trivial, dig it
// out. Otherwise, if there's any user-provided default constructor, point
// to that as an example of why there's not a trivial one.
- CXXConstructorDecl *DefCtor = 0;
+ CXXConstructorDecl *DefCtor = nullptr;
if (RD->needsImplicitDefaultConstructor())
S.DeclareImplicitDefaultConstructor(RD);
for (auto *CI : RD->ctors()) {
@@ -5493,7 +5495,7 @@ static CXXConstructorDecl *findUserDeclaredCtor(CXXRecordDecl *RD) {
return CD;
}
- return 0;
+ return nullptr;
}
/// The kind of subobject we are checking for triviality. The values of this
@@ -5519,7 +5521,7 @@ static bool checkTrivialSubobjectCall(Sema &S, SourceLocation SubobjLoc,
CXXMethodDecl *Selected;
if (findTrivialSpecialMember(S, SubRD, CSM, SubType.getCVRQualifiers(),
- ConstRHS, Diagnose ? &Selected : 0))
+ ConstRHS, Diagnose ? &Selected : nullptr))
return true;
if (Diagnose) {
@@ -6080,7 +6082,7 @@ void Sema::ActOnDelayedCXXMethodParameter(Scope *S, Decl *ParamD) {
// If this parameter has an unparsed default argument, clear it out
// to make way for the parsed default argument.
if (Param->hasUnparsedDefaultArg())
- Param->setDefaultArg(0);
+ Param->setDefaultArg(nullptr);
S->AddDecl(Param);
if (Param->getDeclName())
@@ -6233,7 +6235,7 @@ bool Sema::CheckDestructor(CXXDestructorDecl *Destructor) {
Loc = RD->getLocation();
// If we have a virtual destructor, look up the deallocation function
- FunctionDecl *OperatorDelete = 0;
+ FunctionDecl *OperatorDelete = nullptr;
DeclarationName Name =
Context.DeclarationNames.getCXXOperatorName(OO_Delete);
if (FindDeallocationFunction(Loc, RD, Name, OperatorDelete))
@@ -6556,7 +6558,7 @@ Decl *Sema::ActOnStartNamespaceDef(Scope *NamespcScope,
bool AddToKnown = false;
Scope *DeclRegionScope = NamespcScope->getParent();
- NamespaceDecl *PrevNS = 0;
+ NamespaceDecl *PrevNS = nullptr;
if (II) {
// C++ [namespace.def]p2:
// The identifier in an original-namespace-definition shall not
@@ -6572,7 +6574,7 @@ Decl *Sema::ActOnStartNamespaceDef(Scope *NamespcScope,
const unsigned IDNS = Decl::IDNS_Ordinary | Decl::IDNS_Member |
Decl::IDNS_Type | Decl::IDNS_Using | Decl::IDNS_Tag |
Decl::IDNS_Namespace;
- NamedDecl *PrevDecl = 0;
+ NamedDecl *PrevDecl = nullptr;
DeclContext::lookup_result R = CurContext->getRedeclContext()->lookup(II);
for (DeclContext::lookup_iterator I = R.begin(), E = R.end(); I != E;
++I) {
@@ -6733,7 +6735,7 @@ NamespaceDecl *Sema::getOrCreateStdNamespace() {
/*Inline=*/false,
SourceLocation(), SourceLocation(),
&PP.getIdentifierTable().get("std"),
- /*PrevDecl=*/0);
+ /*PrevDecl=*/nullptr);
getStdNamespace()->setImplicit(true);
}
@@ -6750,8 +6752,8 @@ bool Sema::isStdInitializerList(QualType Ty, QualType *Element) {
if (!StdNamespace) // If we haven't seen namespace std yet, this can't be it.
return false;
- ClassTemplateDecl *Template = 0;
- const TemplateArgument *Arguments = 0;
+ ClassTemplateDecl *Template = nullptr;
+ const TemplateArgument *Arguments = nullptr;
if (const RecordType *RT = Ty->getAs<RecordType>()) {
@@ -6804,14 +6806,14 @@ static ClassTemplateDecl *LookupStdInitializerList(Sema &S, SourceLocation Loc){
NamespaceDecl *Std = S.getStdNamespace();
if (!Std) {
S.Diag(Loc, diag::err_implied_std_initializer_list_not_found);
- return 0;
+ return nullptr;
}
LookupResult Result(S, &S.PP.getIdentifierTable().get("initializer_list"),
Loc, Sema::LookupOrdinaryName);
if (!S.LookupQualifiedName(Result, Std)) {
S.Diag(Loc, diag::err_implied_std_initializer_list_not_found);
- return 0;
+ return nullptr;
}
ClassTemplateDecl *Template = Result.getAsSingle<ClassTemplateDecl>();
if (!Template) {
@@ -6819,7 +6821,7 @@ static ClassTemplateDecl *LookupStdInitializerList(Sema &S, SourceLocation Loc){
// We found something weird. Complain about the first thing we found.
NamedDecl *Found = *Result.begin();
S.Diag(Found->getLocation(), diag::err_malformed_std_initializer_list);
- return 0;
+ return nullptr;
}
// We found some template called std::initializer_list. Now verify that it's
@@ -6828,7 +6830,7 @@ static ClassTemplateDecl *LookupStdInitializerList(Sema &S, SourceLocation Loc){
if (Params->getMinRequiredArguments() != 1 ||
!isa<TemplateTypeParmDecl>(Params->getParam(0))) {
S.Diag(Template->getLocation(), diag::err_malformed_std_initializer_list);
- return 0;
+ return nullptr;
}
return Template;
@@ -6863,7 +6865,7 @@ bool Sema::isInitListConstructor(const CXXConstructorDecl* Ctor) {
if (const ReferenceType *RT = ArgType->getAs<ReferenceType>())
ArgType = RT->getPointeeType().getUnqualifiedType();
- return isStdInitializerList(ArgType, 0);
+ return isStdInitializerList(ArgType, nullptr);
}
/// \brief Determine whether a using statement is in a context where it will be
@@ -6938,8 +6940,8 @@ Decl *Sema::ActOnUsingDirective(Scope *S,
S = S->getParent();
assert(S->getFlags() & Scope::DeclScope && "Invalid Scope.");
- UsingDirectiveDecl *UDir = 0;
- NestedNameSpecifier *Qualifier = 0;
+ UsingDirectiveDecl *UDir = nullptr;
+ NestedNameSpecifier *Qualifier = nullptr;
if (SS.isSet())
Qualifier = SS.getScopeRep();
@@ -6947,7 +6949,7 @@ Decl *Sema::ActOnUsingDirective(Scope *S,
LookupResult R(*this, NamespcName, IdentLoc, LookupNamespaceName);
LookupParsedName(R, S, &SS);
if (R.isAmbiguous())
- return 0;
+ return nullptr;
if (R.empty()) {
R.clear();
@@ -7048,23 +7050,23 @@ Decl *Sema::ActOnUsingDeclaration(Scope *S,
if (getLangOpts().CPlusPlus11) break;
- return 0;
-
+ return nullptr;
+
case UnqualifiedId::IK_DestructorName:
Diag(Name.getLocStart(), diag::err_using_decl_destructor)
<< SS.getRange();
- return 0;
-
+ return nullptr;
+
case UnqualifiedId::IK_TemplateId:
Diag(Name.getLocStart(), diag::err_using_decl_template_id)
<< SourceRange(Name.TemplateId->LAngleLoc, Name.TemplateId->RAngleLoc);
- return 0;
+ return nullptr;
}
DeclarationNameInfo TargetNameInfo = GetNameFromUnqualifiedId(Name);
DeclarationName TargetName = TargetNameInfo.getName();
if (!TargetName)
- return 0;
+ return nullptr;
// Warn about access declarations.
if (!HasUsingKeyword) {
@@ -7076,7 +7078,7 @@ Decl *Sema::ActOnUsingDeclaration(Scope *S,
if (DiagnoseUnexpandedParameterPack(SS, UPPC_UsingDeclaration) ||
DiagnoseUnexpandedParameterPack(TargetNameInfo, UPPC_UsingDeclaration))
- return 0;
+ return nullptr;
NamedDecl *UD = BuildUsingDeclaration(S, AS, UsingLoc, SS,
TargetNameInfo, AttrList,
@@ -7168,7 +7170,7 @@ bool Sema::CheckUsingShadowDecl(UsingDecl *Using, NamedDecl *Orig,
//
// FIXME: but we might be increasing its access, in which case we
// should redeclare it.
- NamedDecl *NonTag = 0, *Tag = 0;
+ NamedDecl *NonTag = nullptr, *Tag = nullptr;
bool FoundEquivalentDecl = false;
for (LookupResult::iterator I = Previous.begin(), E = Previous.end();
I != E; ++I) {
@@ -7186,8 +7188,9 @@ bool Sema::CheckUsingShadowDecl(UsingDecl *Using, NamedDecl *Orig,
return false;
if (FunctionDecl *FD = Target->getAsFunction()) {
- NamedDecl *OldDecl = 0;
- switch (CheckOverload(0, FD, Previous, OldDecl, /*IsForUsingDecl*/ true)) {
+ NamedDecl *OldDecl = nullptr;
+ switch (CheckOverload(nullptr, FD, Previous, OldDecl,
+ /*IsForUsingDecl*/ true)) {
case Ovl_Overload:
return false;
@@ -7328,7 +7331,7 @@ static CXXBaseSpecifier *findDirectBaseWithType(CXXRecordDecl *Derived,
if (BaseType->isDependentType())
AnyDependentBases = true;
}
- return 0;
+ return nullptr;
}
namespace {
@@ -7424,7 +7427,7 @@ NamedDecl *Sema::BuildUsingDeclaration(Scope *S, AccessSpecifier AS,
if (SS.isEmpty()) {
Diag(IdentLoc, diag::err_using_requires_qualname);
- return 0;
+ return nullptr;
}
// Do the redeclaration lookup in the current scope.
@@ -7458,11 +7461,11 @@ NamedDecl *Sema::BuildUsingDeclaration(Scope *S, AccessSpecifier AS,
// Check for invalid redeclarations.
if (CheckUsingDeclRedeclaration(UsingLoc, HasTypenameKeyword,
SS, IdentLoc, Previous))
- return 0;
+ return nullptr;
// Check for bad qualifiers.
if (CheckUsingDeclQualifier(UsingLoc, SS, NameInfo, IdentLoc))
- return 0;
+ return nullptr;
DeclContext *LookupContext = computeDeclContext(SS);
NamedDecl *D;
@@ -7554,7 +7557,7 @@ NamedDecl *Sema::BuildUsingDeclaration(Scope *S, AccessSpecifier AS,
NameInfo.setName(Context.DeclarationNames.getCXXConstructorName(
Context.getCanonicalType(Context.getRecordType(RD))));
- NameInfo.setNamedTypeInfo(0);
+ NameInfo.setNamedTypeInfo(nullptr);
// Build it and process it as an inheriting constructor.
UsingDecl *UD = BuildValid();
@@ -7605,7 +7608,7 @@ NamedDecl *Sema::BuildUsingDeclaration(Scope *S, AccessSpecifier AS,
UsingDecl *UD = BuildValid();
for (LookupResult::iterator I = R.begin(), E = R.end(); I != E; ++I) {
- UsingShadowDecl *PrevDecl = 0;
+ UsingShadowDecl *PrevDecl = nullptr;
if (!CheckUsingShadowDecl(UD, *I, Previous, PrevDecl))
BuildUsingShadowDecl(S, UD, *I, PrevDecl);
}
@@ -7718,7 +7721,7 @@ bool Sema::CheckUsingDeclQualifier(SourceLocation UsingLoc,
if (!NamedContext || NamedContext->isRecord()) {
auto *RD = dyn_cast<CXXRecordDecl>(NamedContext);
if (RD && RequireCompleteDeclContext(const_cast<CXXScopeSpec&>(SS), RD))
- RD = 0;
+ RD = nullptr;
Diag(NameLoc, diag::err_using_decl_can_not_refer_to_class_member)
<< SS.getRange();
@@ -7897,15 +7900,15 @@ Decl *Sema::ActOnAliasDeclaration(Scope *S,
"got alias-declaration outside of declaration scope");
if (Type.isInvalid())
- return 0;
+ return nullptr;
bool Invalid = false;
DeclarationNameInfo NameInfo = GetNameFromUnqualifiedId(Name);
- TypeSourceInfo *TInfo = 0;
+ TypeSourceInfo *TInfo = nullptr;
GetTypeFromParser(Type.get(), &TInfo);
if (DiagnoseClassNameShadow(CurContext, NameInfo))
- return 0;
+ return nullptr;
if (DiagnoseUnexpandedParameterPack(Name.StartLocation, TInfo,
UPPC_DeclarationType)) {
@@ -7944,8 +7947,8 @@ Decl *Sema::ActOnAliasDeclaration(Scope *S,
NamedDecl *NewND;
if (TemplateParamLists.size()) {
- TypeAliasTemplateDecl *OldDecl = 0;
- TemplateParameterList *OldTemplateParams = 0;
+ TypeAliasTemplateDecl *OldDecl = nullptr;
+ TemplateParameterList *OldTemplateParams = nullptr;
if (TemplateParamLists.size() != 1) {
Diag(UsingLoc, diag::err_alias_template_extra_headers)
@@ -8000,7 +8003,7 @@ Decl *Sema::ActOnAliasDeclaration(Scope *S,
// and check the parameter list.
if (CheckTemplateParameterList(TemplateParams, OldTemplateParams,
TPC_TypeAliasTemplate))
- return 0;
+ return nullptr;
TypeAliasTemplateDecl *NewDecl =
TypeAliasTemplateDecl::Create(Context, CurContext, UsingLoc,
@@ -8044,7 +8047,7 @@ Decl *Sema::ActOnNamespaceAliasDef(Scope *S,
= LookupSingleName(S, Alias, AliasLoc, LookupOrdinaryName,
ForRedeclaration);
if (PrevDecl && !isDeclInScope(PrevDecl, CurContext, S))
- PrevDecl = 0;
+ PrevDecl = nullptr;
if (PrevDecl) {
if (NamespaceAliasDecl *AD = dyn_cast<NamespaceAliasDecl>(PrevDecl)) {
@@ -8054,23 +8057,23 @@ Decl *Sema::ActOnNamespaceAliasDef(Scope *S,
// declaration to maintain better source information.
if (!R.isAmbiguous() && !R.empty() &&
AD->getNamespace()->Equals(getNamespaceDecl(R.getFoundDecl())))
- return 0;
+ return nullptr;
}
unsigned DiagID = isa<NamespaceDecl>(PrevDecl) ? diag::err_redefinition :
diag::err_redefinition_different_kind;
Diag(AliasLoc, DiagID) << Alias;
Diag(PrevDecl->getLocation(), diag::note_previous_definition);
- return 0;
+ return nullptr;
}
if (R.isAmbiguous())
- return 0;
+ return nullptr;
if (R.empty()) {
if (!TryNamespaceTypoCorrection(*this, R, S, SS, IdentLoc, Ident)) {
Diag(IdentLoc, diag::err_expected_namespace_name) << SS.getRange();
- return 0;
+ return nullptr;
}
}
@@ -8268,7 +8271,7 @@ CXXConstructorDecl *Sema::DeclareImplicitDefaultConstructor(
DeclaringSpecialMember DSM(*this, ClassDecl, CXXDefaultConstructor);
if (DSM.isAlreadyBeingDeclared())
- return 0;
+ return nullptr;
bool Constexpr = defaultedSpecialMemberIsConstexpr(*this, ClassDecl,
CXXDefaultConstructor,
@@ -8282,9 +8285,9 @@ CXXConstructorDecl *Sema::DeclareImplicitDefaultConstructor(
= Context.DeclarationNames.getCXXConstructorName(ClassType);
DeclarationNameInfo NameInfo(Name, ClassLoc);
CXXConstructorDecl *DefaultCon = CXXConstructorDecl::Create(
- Context, ClassDecl, ClassLoc, NameInfo, /*Type*/QualType(), /*TInfo=*/0,
- /*isExplicit=*/false, /*isInline=*/true, /*isImplicitlyDeclared=*/true,
- Constexpr);
+ Context, ClassDecl, ClassLoc, NameInfo, /*Type*/QualType(),
+ /*TInfo=*/nullptr, /*isExplicit=*/false, /*isInline=*/true,
+ /*isImplicitlyDeclared=*/true, Constexpr);
DefaultCon->setAccess(AS_public);
DefaultCon->setDefaulted();
DefaultCon->setImplicit();
@@ -8370,7 +8373,7 @@ private:
/// Information about an inheriting constructor.
struct InheritingConstructor {
InheritingConstructor()
- : DeclaredInDerived(false), BaseCtor(0), DerivedCtor(0) {}
+ : DeclaredInDerived(false), BaseCtor(nullptr), DerivedCtor(nullptr) {}
/// If \c true, a constructor with this signature is already declared
/// in the derived class.
@@ -8551,7 +8554,7 @@ private:
Context.getCanonicalType(Context.getRecordType(Derived)));
DeclarationNameInfo NameInfo(Name, UsingLoc);
- TemplateParameterList *TemplateParams = 0;
+ TemplateParameterList *TemplateParams = nullptr;
if (const FunctionTemplateDecl *FTD =
BaseCtor->getDescribedFunctionTemplate()) {
TemplateParams = FTD->getTemplateParameters();
@@ -8588,8 +8591,8 @@ private:
TypeSourceInfo *TInfo =
Context.getTrivialTypeSourceInfo(FPT->getParamType(I), UsingLoc);
ParmVarDecl *PD = ParmVarDecl::Create(
- Context, DerivedCtor, UsingLoc, UsingLoc, /*IdentifierInfo=*/0,
- FPT->getParamType(I), TInfo, SC_None, /*DefaultArg=*/0);
+ Context, DerivedCtor, UsingLoc, UsingLoc, /*IdentifierInfo=*/nullptr,
+ FPT->getParamType(I), TInfo, SC_None, /*DefaultArg=*/nullptr);
PD->setScopeInfo(0, I);
PD->setImplicit();
ParamDecls.push_back(PD);
@@ -8725,7 +8728,7 @@ CXXDestructorDecl *Sema::DeclareImplicitDestructor(CXXRecordDecl *ClassDecl) {
DeclaringSpecialMember DSM(*this, ClassDecl, CXXDestructor);
if (DSM.isAlreadyBeingDeclared())
- return 0;
+ return nullptr;
// Create the actual destructor declaration.
CanQualType ClassType
@@ -8736,7 +8739,7 @@ CXXDestructorDecl *Sema::DeclareImplicitDestructor(CXXRecordDecl *ClassDecl) {
DeclarationNameInfo NameInfo(Name, ClassLoc);
CXXDestructorDecl *Destructor
= CXXDestructorDecl::Create(Context, ClassDecl, ClassLoc, NameInfo,
- QualType(), 0, /*isInline=*/true,
+ QualType(), nullptr, /*isInline=*/true,
/*isImplicitlyDeclared=*/true);
Destructor->setAccess(AS_public);
Destructor->setDefaulted();
@@ -8925,8 +8928,8 @@ class MemberBuilder: public ExprBuilder {
public:
virtual Expr *build(Sema &S, SourceLocation Loc) const override {
return assertNotNull(S.BuildMemberReferenceExpr(
- Builder.build(S, Loc), Type, Loc, IsArrow, SS, SourceLocation(), 0,
- MemberLookup, 0).take());
+ Builder.build(S, Loc), Type, Loc, IsArrow, SS, SourceLocation(),
+ nullptr, MemberLookup, nullptr).take());
}
MemberBuilder(const ExprBuilder &Builder, QualType Type, bool IsArrow,
@@ -9017,13 +9020,13 @@ buildMemcpyForAssignmentOp(Sema &S, SourceLocation Loc, QualType T,
return StmtError();
ExprResult MemCpyRef = S.BuildDeclRefExpr(MemCpy, S.Context.BuiltinFnTy,
- VK_RValue, Loc, 0);
+ VK_RValue, Loc, nullptr);
assert(MemCpyRef.isUsable() && "Builtin reference cannot fail");
Expr *CallArgs[] = {
To, From, IntegerLiteral::Create(S.Context, Size, SizeType, Loc)
};
- ExprResult Call = S.ActOnCallExpr(/*Scope=*/0, MemCpyRef.take(),
+ ExprResult Call = S.ActOnCallExpr(/*Scope=*/nullptr, MemCpyRef.take(),
Loc, CallArgs, Loc);
assert(!Call.isInvalid() && "Call to __builtin_memcpy cannot fail!");
@@ -9126,7 +9129,7 @@ buildSingleCopyAssignRecursively(Sema &S, SourceLocation Loc, QualType T,
CXXScopeSpec SS;
const Type *CanonicalT = S.Context.getCanonicalType(T.getTypePtr());
SS.MakeTrivial(S.Context,
- NestedNameSpecifier::Create(S.Context, 0, false,
+ NestedNameSpecifier::Create(S.Context, nullptr, false,
CanonicalT),
Loc);
@@ -9134,9 +9137,9 @@ buildSingleCopyAssignRecursively(Sema &S, SourceLocation Loc, QualType T,
ExprResult OpEqualRef
= S.BuildMemberReferenceExpr(To.build(S, Loc), T, Loc, /*isArrow=*/false,
SS, /*TemplateKWLoc=*/SourceLocation(),
- /*FirstQualifierInScope=*/0,
+ /*FirstQualifierInScope=*/nullptr,
OpLookup,
- /*TemplateArgs=*/0,
+ /*TemplateArgs=*/nullptr,
/*SuppressQualifierCheck=*/true);
if (OpEqualRef.isInvalid())
return StmtError();
@@ -9144,7 +9147,7 @@ buildSingleCopyAssignRecursively(Sema &S, SourceLocation Loc, QualType T,
// Build the call to the assignment operator.
Expr *FromInst = From.build(S, Loc);
- ExprResult Call = S.BuildCallToMemberFunction(/*Scope=*/0,
+ ExprResult Call = S.BuildCallToMemberFunction(/*Scope=*/nullptr,
OpEqualRef.takeAs<Expr>(),
Loc, FromInst, Loc);
if (Call.isInvalid())
@@ -9154,7 +9157,7 @@ buildSingleCopyAssignRecursively(Sema &S, SourceLocation Loc, QualType T,
// bail out. We'll replace the whole shebang with a memcpy.
CXXMemberCallExpr *CE = dyn_cast<CXXMemberCallExpr>(Call.get());
if (CE && CE->getMethodDecl()->isTrivial() && Depth)
- return StmtResult((Stmt*)0);
+ return StmtResult((Stmt*)nullptr);
// Convert to an expression-statement, and clean up any produced
// temporaries.
@@ -9183,7 +9186,7 @@ buildSingleCopyAssignRecursively(Sema &S, SourceLocation Loc, QualType T,
QualType SizeType = S.Context.getSizeType();
// Create the iteration variable.
- IdentifierInfo *IterationVarName = 0;
+ IdentifierInfo *IterationVarName = nullptr;
{
SmallString<8> Str;
llvm::raw_svector_ostream OS(Str);
@@ -9243,7 +9246,7 @@ buildSingleCopyAssignRecursively(Sema &S, SourceLocation Loc, QualType T,
// Construct the loop that copies all elements of this array.
return S.ActOnForStmt(Loc, Loc, InitStmt,
S.MakeFullExpr(Comparison),
- 0, S.MakeFullDiscardedValueExpr(Increment),
+ nullptr, S.MakeFullDiscardedValueExpr(Increment),
Loc, Copy.take());
}
@@ -9333,7 +9336,7 @@ CXXMethodDecl *Sema::DeclareImplicitCopyAssignment(CXXRecordDecl *ClassDecl) {
DeclaringSpecialMember DSM(*this, ClassDecl, CXXCopyAssignment);
if (DSM.isAlreadyBeingDeclared())
- return 0;
+ return nullptr;
QualType ArgType = Context.getTypeDeclType(ClassDecl);
QualType RetType = Context.getLValueReferenceType(ArgType);
@@ -9353,8 +9356,8 @@ CXXMethodDecl *Sema::DeclareImplicitCopyAssignment(CXXRecordDecl *ClassDecl) {
DeclarationNameInfo NameInfo(Name, ClassLoc);
CXXMethodDecl *CopyAssignment =
CXXMethodDecl::Create(Context, ClassDecl, ClassLoc, NameInfo, QualType(),
- /*TInfo=*/ 0, /*StorageClass=*/ SC_None,
- /*isInline=*/ true, Constexpr, SourceLocation());
+ /*TInfo=*/nullptr, /*StorageClass=*/SC_None,
+ /*isInline=*/true, Constexpr, SourceLocation());
CopyAssignment->setAccess(AS_public);
CopyAssignment->setDefaulted();
CopyAssignment->setImplicit();
@@ -9366,9 +9369,10 @@ CXXMethodDecl *Sema::DeclareImplicitCopyAssignment(CXXRecordDecl *ClassDecl) {
// Add the parameter to the operator.
ParmVarDecl *FromParam = ParmVarDecl::Create(Context, CopyAssignment,
- ClassLoc, ClassLoc, /*Id=*/0,
- ArgType, /*TInfo=*/0,
- SC_None, 0);
+ ClassLoc, ClassLoc,
+ /*Id=*/nullptr, ArgType,
+ /*TInfo=*/nullptr, SC_None,
+ nullptr);
CopyAssignment->setParams(FromParam);
AddOverriddenMethods(ClassDecl, CopyAssignment);
@@ -9399,7 +9403,7 @@ static void diagnoseDeprecatedCopyOperation(Sema &S, CXXMethodDecl *CopyOp,
assert(CopyOp->isImplicit());
CXXRecordDecl *RD = CopyOp->getParent();
- CXXMethodDecl *UserDeclaredOperation = 0;
+ CXXMethodDecl *UserDeclaredOperation = nullptr;
// In Microsoft mode, assignment operations don't affect constructors and
// vice versa.
@@ -9707,7 +9711,7 @@ CXXMethodDecl *Sema::DeclareImplicitMoveAssignment(CXXRecordDecl *ClassDecl) {
DeclaringSpecialMember DSM(*this, ClassDecl, CXXMoveAssignment);
if (DSM.isAlreadyBeingDeclared())
- return 0;
+ return nullptr;
// Note: The following rules are largely analoguous to the move
// constructor rules.
@@ -9727,7 +9731,7 @@ CXXMethodDecl *Sema::DeclareImplicitMoveAssignment(CXXRecordDecl *ClassDecl) {
DeclarationNameInfo NameInfo(Name, ClassLoc);
CXXMethodDecl *MoveAssignment =
CXXMethodDecl::Create(Context, ClassDecl, ClassLoc, NameInfo, QualType(),
- /*TInfo=*/0, /*StorageClass=*/SC_None,
+ /*TInfo=*/nullptr, /*StorageClass=*/SC_None,
/*isInline=*/true, Constexpr, SourceLocation());
MoveAssignment->setAccess(AS_public);
MoveAssignment->setDefaulted();
@@ -9740,9 +9744,10 @@ CXXMethodDecl *Sema::DeclareImplicitMoveAssignment(CXXRecordDecl *ClassDecl) {
// Add the parameter to the operator.
ParmVarDecl *FromParam = ParmVarDecl::Create(Context, MoveAssignment,
- ClassLoc, ClassLoc, /*Id=*/0,
- ArgType, /*TInfo=*/0,
- SC_None, 0);
+ ClassLoc, ClassLoc,
+ /*Id=*/nullptr, ArgType,
+ /*TInfo=*/nullptr, SC_None,
+ nullptr);
MoveAssignment->setParams(FromParam);
AddOverriddenMethods(ClassDecl, MoveAssignment);
@@ -9834,7 +9839,7 @@ static void checkMoveAssignmentForRepeatedMove(Sema &S, CXXRecordDecl *Class,
<< Base << BI.getType() << BaseSpec->getSourceRange();
// Only diagnose each vbase once.
- Existing = 0;
+ Existing = nullptr;
}
} else {
// Only walk over bases that have defaulted move assignment operators.
@@ -10122,7 +10127,7 @@ CXXConstructorDecl *Sema::DeclareImplicitCopyConstructor(
DeclaringSpecialMember DSM(*this, ClassDecl, CXXCopyConstructor);
if (DSM.isAlreadyBeingDeclared())
- return 0;
+ return nullptr;
QualType ClassType = Context.getTypeDeclType(ClassDecl);
QualType ArgType = ClassType;
@@ -10144,7 +10149,7 @@ CXXConstructorDecl *Sema::DeclareImplicitCopyConstructor(
// An implicitly-declared copy constructor is an inline public
// member of its class.
CXXConstructorDecl *CopyConstructor = CXXConstructorDecl::Create(
- Context, ClassDecl, ClassLoc, NameInfo, QualType(), /*TInfo=*/0,
+ Context, ClassDecl, ClassLoc, NameInfo, QualType(), /*TInfo=*/nullptr,
/*isExplicit=*/false, /*isInline=*/true, /*isImplicitlyDeclared=*/true,
Constexpr);
CopyConstructor->setAccess(AS_public);
@@ -10159,9 +10164,9 @@ CXXConstructorDecl *Sema::DeclareImplicitCopyConstructor(
// Add the parameter to the constructor.
ParmVarDecl *FromParam = ParmVarDecl::Create(Context, CopyConstructor,
ClassLoc, ClassLoc,
- /*IdentifierInfo=*/0,
- ArgType, /*TInfo=*/0,
- SC_None, 0);
+ /*IdentifierInfo=*/nullptr,
+ ArgType, /*TInfo=*/nullptr,
+ SC_None, nullptr);
CopyConstructor->setParams(FromParam);
CopyConstructor->setTrivial(
@@ -10286,7 +10291,7 @@ CXXConstructorDecl *Sema::DeclareImplicitMoveConstructor(
DeclaringSpecialMember DSM(*this, ClassDecl, CXXMoveConstructor);
if (DSM.isAlreadyBeingDeclared())
- return 0;
+ return nullptr;
QualType ClassType = Context.getTypeDeclType(ClassDecl);
QualType ArgType = Context.getRValueReferenceType(ClassType);
@@ -10305,7 +10310,7 @@ CXXConstructorDecl *Sema::DeclareImplicitMoveConstructor(
// An implicitly-declared copy/move constructor is an inline public
// member of its class.
CXXConstructorDecl *MoveConstructor = CXXConstructorDecl::Create(
- Context, ClassDecl, ClassLoc, NameInfo, QualType(), /*TInfo=*/0,
+ Context, ClassDecl, ClassLoc, NameInfo, QualType(), /*TInfo=*/nullptr,
/*isExplicit=*/false, /*isInline=*/true, /*isImplicitlyDeclared=*/true,
Constexpr);
MoveConstructor->setAccess(AS_public);
@@ -10320,9 +10325,9 @@ CXXConstructorDecl *Sema::DeclareImplicitMoveConstructor(
// Add the parameter to the constructor.
ParmVarDecl *FromParam = ParmVarDecl::Create(Context, MoveConstructor,
ClassLoc, ClassLoc,
- /*IdentifierInfo=*/0,
- ArgType, /*TInfo=*/0,
- SC_None, 0);
+ /*IdentifierInfo=*/nullptr,
+ ArgType, /*TInfo=*/nullptr,
+ SC_None, nullptr);
MoveConstructor->setParams(FromParam);
MoveConstructor->setTrivial(
@@ -10391,16 +10396,15 @@ void Sema::DefineImplicitLambdaToFunctionPointerConversion(
// cache the deduced template arguments for this specialization
// so that we can use them to retrieve the corresponding call-operator
// and static-invoker.
- const TemplateArgumentList *DeducedTemplateArgs = 0;
-
-
+ const TemplateArgumentList *DeducedTemplateArgs = nullptr;
+
// Retrieve the corresponding call-operator specialization.
if (Lambda->isGenericLambda()) {
assert(Conv->isFunctionTemplateSpecialization());
FunctionTemplateDecl *CallOpTemplate =
CallOp->getDescribedFunctionTemplate();
DeducedTemplateArgs = Conv->getTemplateSpecializationArgs();
- void *InsertPos = 0;
+ void *InsertPos = nullptr;
FunctionDecl *CallOpSpec = CallOpTemplate->findSpecialization(
DeducedTemplateArgs->data(),
DeducedTemplateArgs->size(),
@@ -10427,7 +10431,7 @@ void Sema::DefineImplicitLambdaToFunctionPointerConversion(
"Must have deduced template arguments from Conversion Operator");
FunctionTemplateDecl *InvokeTemplate =
Invoker->getDescribedFunctionTemplate();
- void *InsertPos = 0;
+ void *InsertPos = nullptr;
FunctionDecl *InvokeSpec = InvokeTemplate->findSpecialization(
DeducedTemplateArgs->data(),
DeducedTemplateArgs->size(),
@@ -10488,7 +10492,7 @@ void Sema::DefineImplicitLambdaToBlockPointerConversion(
if (!BuildBlock.isInvalid() && !getLangOpts().ObjCAutoRefCount)
BuildBlock = ImplicitCastExpr::Create(Context, BuildBlock.get()->getType(),
CK_CopyAndAutoreleaseBlockObject,
- BuildBlock.get(), 0, VK_RValue);
+ BuildBlock.get(), nullptr, VK_RValue);
if (BuildBlock.isInvalid()) {
Diag(CurrentLocation, diag::note_lambda_to_block_conv);
@@ -11081,7 +11085,7 @@ Decl *Sema::ActOnStartLinkageSpecification(Scope *S, SourceLocation ExternLoc,
if (!Lit->isAscii()) {
Diag(LangStr->getExprLoc(), diag::err_language_linkage_spec_not_ascii)
<< LangStr->getSourceRange();
- return 0;
+ return nullptr;
}
StringRef Lang = Lit->getString();
@@ -11093,7 +11097,7 @@ Decl *Sema::ActOnStartLinkageSpecification(Scope *S, SourceLocation ExternLoc,
else {
Diag(LangStr->getExprLoc(), diag::err_language_linkage_spec_unknown)
<< LangStr->getSourceRange();
- return 0;
+ return nullptr;
}
// FIXME: Add all the various semantics of linkage specifications
@@ -11280,7 +11284,7 @@ Decl *Sema::ActOnExceptionDeclarator(Scope *S, Declarator &D) {
if (PrevDecl->isTemplateParameter()) {
// Maybe we will complain about the shadowed template parameter.
DiagnoseTemplateParameterShadow(D.getIdentifierLoc(), PrevDecl);
- PrevDecl = 0;
+ PrevDecl = nullptr;
}
}
@@ -11314,7 +11318,7 @@ Decl *Sema::ActOnStaticAssertDeclaration(SourceLocation StaticAssertLoc,
StringLiteral *AssertMessage = cast<StringLiteral>(AssertMessageExpr);
if (DiagnoseUnexpandedParameterPack(AssertExpr, UPPC_StaticAssertExpression))
- return 0;
+ return nullptr;
return BuildStaticAssertDeclaration(StaticAssertLoc, AssertExpr,
AssertMessage, RParenLoc, false);
@@ -11342,7 +11346,7 @@ Decl *Sema::BuildStaticAssertDeclaration(SourceLocation StaticAssertLoc,
if (!Failed && !Cond) {
SmallString<256> MsgBuffer;
llvm::raw_svector_ostream Msg(MsgBuffer);
- AssertMessage->printPretty(Msg, 0, getPrintingPolicy());
+ AssertMessage->printPretty(Msg, nullptr, getPrintingPolicy());
Diag(StaticAssertLoc, diag::err_static_assert_failed)
<< Msg.str() << AssertExpr->getSourceRange();
Failed = true;
@@ -11446,12 +11450,12 @@ Decl *Sema::ActOnTemplatedFriendTag(Scope *S, SourceLocation FriendLoc,
if (TemplateParameterList *TemplateParams =
MatchTemplateParametersToScopeSpecifier(
- TagLoc, NameLoc, SS, 0, TempParamLists, /*friend*/ true,
+ TagLoc, NameLoc, SS, nullptr, TempParamLists, /*friend*/ true,
isExplicitSpecialization, Invalid)) {
if (TemplateParams->size() > 0) {
// This is a declaration of a class template.
if (Invalid)
- return 0;
+ return nullptr;
return CheckClassTemplate(S, TagSpec, TUK_Friend, TagLoc,
SS, Name, NameLoc, Attr,
@@ -11467,7 +11471,7 @@ Decl *Sema::ActOnTemplatedFriendTag(Scope *S, SourceLocation FriendLoc,
}
}
- if (Invalid) return 0;
+ if (Invalid) return nullptr;
bool isAllExplicitSpecializations = true;
for (unsigned I = TempParamLists.size(); I-- > 0; ) {
@@ -11502,7 +11506,7 @@ Decl *Sema::ActOnTemplatedFriendTag(Scope *S, SourceLocation FriendLoc,
QualType T = CheckTypenameType(Keyword, TagLoc, QualifierLoc,
*Name, NameLoc);
if (T.isNull())
- return 0;
+ return nullptr;
TypeSourceInfo *TSI = Context.CreateTypeSourceInfo(T);
if (isa<DependentNameType>(T)) {
@@ -11582,10 +11586,10 @@ Decl *Sema::ActOnFriendTypeDecl(Scope *S, const DeclSpec &DS,
TypeSourceInfo *TSI = GetTypeForDeclarator(TheDeclarator, S);
QualType T = TSI->getType();
if (TheDeclarator.isInvalidType())
- return 0;
+ return nullptr;
if (DiagnoseUnexpandedParameterPack(Loc, TSI, UPPC_FriendDeclaration))
- return 0;
+ return nullptr;
// This is definitely an error in C++98. It's probably meant to
// be forbidden in C++0x, too, but the specification is just
@@ -11604,7 +11608,7 @@ Decl *Sema::ActOnFriendTypeDecl(Scope *S, const DeclSpec &DS,
if (TempParams.size() && !T->isElaboratedTypeSpecifier()) {
Diag(Loc, diag::err_tagless_friend_type_template)
<< DS.getSourceRange();
- return 0;
+ return nullptr;
}
// C++98 [class.friend]p1: A friend of a class is a function
@@ -11629,8 +11633,8 @@ Decl *Sema::ActOnFriendTypeDecl(Scope *S, const DeclSpec &DS,
D = CheckFriendTypeDecl(Loc, DS.getFriendSpecLoc(), TSI);
if (!D)
- return 0;
-
+ return nullptr;
+
D->setAccess(AS_public);
CurContext->addDecl(D);
@@ -11662,7 +11666,7 @@ NamedDecl *Sema::ActOnFriendFunctionDecl(Scope *S, Declarator &D,
// It might be worthwhile to try to recover by creating an
// appropriate declaration.
- return 0;
+ return nullptr;
}
// C++ [namespace.memdef]p3
@@ -11689,7 +11693,7 @@ NamedDecl *Sema::ActOnFriendFunctionDecl(Scope *S, Declarator &D,
if (DiagnoseUnexpandedParameterPack(Loc, TInfo, UPPC_FriendDeclaration) ||
DiagnoseUnexpandedParameterPack(NameInfo, UPPC_FriendDeclaration) ||
DiagnoseUnexpandedParameterPack(SS, UPPC_FriendDeclaration))
- return 0;
+ return nullptr;
// The context we found the declaration in, or in which we should
// create the declaration.
@@ -11702,7 +11706,7 @@ NamedDecl *Sema::ActOnFriendFunctionDecl(Scope *S, Declarator &D,
// - There's no scope specifier and we're in a local class. Only look
// for functions declared in the immediately-enclosing block scope.
// We recover from invalid scope qualifiers as if they just weren't there.
- FunctionDecl *FunctionContainingLocalClass = 0;
+ FunctionDecl *FunctionContainingLocalClass = nullptr;
if ((SS.isInvalid() || !SS.isSet()) &&
(FunctionContainingLocalClass =
cast<CXXRecordDecl>(CurContext)->isLocalClass())) {
@@ -11795,9 +11799,9 @@ NamedDecl *Sema::ActOnFriendFunctionDecl(Scope *S, Declarator &D,
// or function template.
} else if (!SS.getScopeRep()->isDependent()) {
DC = computeDeclContext(SS);
- if (!DC) return 0;
+ if (!DC) return nullptr;
- if (RequireCompleteDeclContext(SS, DC)) return 0;
+ if (RequireCompleteDeclContext(SS, DC)) return nullptr;
LookupQualifiedName(Previous, DC);
@@ -11817,7 +11821,7 @@ NamedDecl *Sema::ActOnFriendFunctionDecl(Scope *S, Declarator &D,
D.setInvalidType();
Diag(Loc, diag::err_qualified_friend_not_found)
<< Name << TInfo->getType();
- return 0;
+ return nullptr;
}
// C++ [class.friend]p1: A friend of a class is a function or
@@ -11869,7 +11873,7 @@ NamedDecl *Sema::ActOnFriendFunctionDecl(Scope *S, Declarator &D,
Diag(Loc, diag::err_introducing_special_friend) <<
(D.getName().getKind() == UnqualifiedId::IK_ConstructorName ? 0 :
D.getName().getKind() == UnqualifiedId::IK_DestructorName ? 1 : 2);
- return 0;
+ return nullptr;
}
}
@@ -11885,7 +11889,7 @@ NamedDecl *Sema::ActOnFriendFunctionDecl(Scope *S, Declarator &D,
bool AddToScope = true;
NamedDecl *ND = ActOnFunctionDeclarator(DCScope, D, DC, TInfo, Previous,
TemplateParams, AddToScope);
- if (!ND) return 0;
+ if (!ND) return nullptr;
assert(ND->getLexicalDeclContext() == CurContext);
@@ -12177,7 +12181,8 @@ bool Sema::CheckOverridingFunctionReturnType(const CXXMethodDecl *New,
diag::err_covariant_return_inaccessible_base,
diag::err_covariant_return_ambiguous_derived_to_base_conv,
// FIXME: Should this point to the return type?
- New->getLocation(), SourceRange(), New->getDeclName(), 0)) {
+ New->getLocation(), SourceRange(), New->getDeclName(),
+ nullptr)) {
// FIXME: this note won't trigger for delayed access control
// diagnostics, and it's impossible to get an undelayed error
// here from access control during the original parse because
@@ -12247,7 +12252,8 @@ static bool isStaticDataMember(const Decl *D) {
/// class X.
void Sema::ActOnCXXEnterDeclInitializer(Scope *S, Decl *D) {
// If there is no declaration, there was an error parsing it.
- if (D == 0 || D->isInvalidDecl()) return;
+ if (!D || D->isInvalidDecl())
+ return;
// We will always have a nested name specifier here, but this declaration
// might not be out of line if the specifier names the current namespace:
@@ -12267,7 +12273,8 @@ void Sema::ActOnCXXEnterDeclInitializer(Scope *S, Decl *D) {
/// initializer for the out-of-line declaration 'D'.
void Sema::ActOnCXXExitDeclInitializer(Scope *S, Decl *D) {
// If there is no declaration, there was an error parsing it.
- if (D == 0 || D->isInvalidDecl()) return;
+ if (!D || D->isInvalidDecl())
+ return;
if (isStaticDataMember(D))
PopExpressionEvaluationContext();
@@ -12444,7 +12451,7 @@ bool Sema::DefineUsedVTables() {
// Optionally warn if we're emitting a weak vtable.
if (Class->isExternallyVisible() &&
Class->getTemplateSpecializationKind() != TSK_ImplicitInstantiation) {
- const FunctionDecl *KeyFunctionDef = 0;
+ const FunctionDecl *KeyFunctionDef = nullptr;
if (!KeyFunction ||
(KeyFunction->hasBody(KeyFunctionDef) &&
KeyFunctionDef->isInlined()))
@@ -12569,7 +12576,7 @@ void DelegatingCycleHelper(CXXConstructorDecl* Ctor,
// Target may not be determinable yet, for instance if this is a dependent
// call in an uninstantiated template.
if (Target) {
- const FunctionDecl *FNTarget = 0;
+ const FunctionDecl *FNTarget = nullptr;
(void)Target->hasBody(FNTarget);
Target = const_cast<CXXConstructorDecl*>(
cast_or_null<CXXConstructorDecl>(FNTarget));
@@ -12577,7 +12584,7 @@ void DelegatingCycleHelper(CXXConstructorDecl* Ctor,
CXXConstructorDecl *Canonical = Ctor->getCanonicalDecl(),
// Avoid dereferencing a null pointer here.
- *TCanonical = Target ? Target->getCanonicalDecl() : 0;
+ *TCanonical = Target? Target->getCanonicalDecl() : nullptr;
if (!Current.insert(Canonical))
return;
@@ -12602,7 +12609,7 @@ void DelegatingCycleHelper(CXXConstructorDecl* Ctor,
CXXConstructorDecl *C = Target;
while (C->getCanonicalDecl() != Canonical) {
- const FunctionDecl *FNTarget = 0;
+ const FunctionDecl *FNTarget = nullptr;
(void)C->getTargetConstructor()->hasBody(FNTarget);
assert(FNTarget && "Ctor cycle through bodiless function");
@@ -12726,7 +12733,7 @@ bool Sema::checkThisInStaticMemberFunctionAttributes(CXXMethodDecl *Method) {
// Check attributes.
for (const auto *A : Method->attrs()) {
// FIXME: This should be emitted by tblgen.
- Expr *Arg = 0;
+ Expr *Arg = nullptr;
ArrayRef<Expr *> Args;
if (const auto *G = dyn_cast<GuardedByAttr>(A))
Arg = G->getArg();
@@ -12814,7 +12821,7 @@ Sema::checkExceptionSpecification(ExceptionSpecificationType EST,
}
if (!NoexceptExpr->isValueDependent())
- NoexceptExpr = VerifyIntegerConstantExpression(NoexceptExpr, 0,
+ NoexceptExpr = VerifyIntegerConstantExpression(NoexceptExpr, nullptr,
diag::err_noexcept_needs_constant_expression,
/*AllowFold*/ false).take();
EPI.NoexceptExpr = NoexceptExpr;
@@ -12874,7 +12881,7 @@ MSPropertyDecl *Sema::HandleMSProperty(Scope *S, RecordDecl *Record,
IdentifierInfo *II = D.getIdentifier();
if (!II) {
Diag(DeclStart, diag::err_anonymous_property);
- return NULL;
+ return nullptr;
}
SourceLocation Loc = D.getIdentifierLoc();
@@ -12899,7 +12906,7 @@ MSPropertyDecl *Sema::HandleMSProperty(Scope *S, RecordDecl *Record,
<< DeclSpec::getSpecifierName(TSCS);
// Check to see if this name was declared as a member previously
- NamedDecl *PrevDecl = 0;
+ NamedDecl *PrevDecl = nullptr;
LookupResult Previous(*this, II, Loc, LookupMemberName, ForRedeclaration);
LookupName(Previous, S);
switch (Previous.getResultKind()) {
@@ -12922,11 +12929,11 @@ MSPropertyDecl *Sema::HandleMSProperty(Scope *S, RecordDecl *Record,
// Maybe we will complain about the shadowed template parameter.
DiagnoseTemplateParameterShadow(D.getIdentifierLoc(), PrevDecl);
// Just pretend that we didn't see the previous declaration.
- PrevDecl = 0;
+ PrevDecl = nullptr;
}
if (PrevDecl && !isDeclInScope(PrevDecl, Record, S))
- PrevDecl = 0;
+ PrevDecl = nullptr;
SourceLocation TSSL = D.getLocStart();
const AttributeList::PropertyData &Data = MSPropertyAttr->getPropertyData();
OpenPOWER on IntegriCloud