diff options
Diffstat (limited to 'clang/lib/Sema/SemaExprMember.cpp')
-rw-r--r-- | clang/lib/Sema/SemaExprMember.cpp | 64 |
1 files changed, 31 insertions, 33 deletions
diff --git a/clang/lib/Sema/SemaExprMember.cpp b/clang/lib/Sema/SemaExprMember.cpp index 95e3668f332..3442b819892 100644 --- a/clang/lib/Sema/SemaExprMember.cpp +++ b/clang/lib/Sema/SemaExprMember.cpp @@ -206,7 +206,7 @@ static void diagnoseInstanceReference(Sema &SemaRef, DeclContext *FunctionLevelDC = SemaRef.getFunctionLevelDeclContext(); CXXMethodDecl *Method = dyn_cast<CXXMethodDecl>(FunctionLevelDC); - CXXRecordDecl *ContextClass = Method ? Method->getParent() : 0; + CXXRecordDecl *ContextClass = Method ? Method->getParent() : nullptr; CXXRecordDecl *RepClass = dyn_cast<CXXRecordDecl>(Rep->getDeclContext()); bool InStaticMethod = Method && Method->isStatic(); @@ -389,7 +389,7 @@ static Decl *FindGetterSetterNameDeclFromProtocolList(const ObjCProtocolDecl*PDe Context)) return D; } - return 0; + return nullptr; } static Decl *FindGetterSetterNameDecl(const ObjCObjectPointerType *QIdTy, @@ -397,7 +397,7 @@ static Decl *FindGetterSetterNameDecl(const ObjCObjectPointerType *QIdTy, const Selector &Sel, ASTContext &Context) { // Check protocols on qualified interfaces. - Decl *GDecl = 0; + Decl *GDecl = nullptr; for (const auto *I : QIdTy->quals()) { if (Member) if (ObjCPropertyDecl *PD = I->FindPropertyDeclaration(Member)) { @@ -590,7 +590,7 @@ LookupMemberExprInRecord(Sema &SemaRef, LookupResult &R, QualType ObjectType = SS.isSet() ? QualType() : QualType(RTy, 0); bool MOUS; - SemaRef.LookupTemplateName(R, 0, SS, ObjectType, false, MOUS); + SemaRef.LookupTemplateName(R, nullptr, SS, ObjectType, false, MOUS); return false; } @@ -626,7 +626,7 @@ LookupMemberExprInRecord(Sema &SemaRef, LookupResult &R, DeclarationName Name = R.getLookupName(); RecordMemberExprValidatorCCC Validator(RTy); TypoCorrection Corrected = SemaRef.CorrectTypo(R.getLookupNameInfo(), - R.getLookupKind(), NULL, + R.getLookupKind(), nullptr, &SS, Validator, Sema::CTK_ErrorRecovery, DC); R.clear(); @@ -643,7 +643,7 @@ LookupMemberExprInRecord(Sema &SemaRef, LookupResult &R, // information to do overload resolution, so we don't know which previous // declaration to point to. if (Corrected.isOverloaded()) - Corrected.setCorrectionDecl(0); + Corrected.setCorrectionDecl(nullptr); bool DroppedSpecifier = Corrected.WillReplaceSpecifier() && Name.getAsString() == Corrected.getAsString(SemaRef.getLangOpts()); @@ -678,7 +678,7 @@ Sema::BuildMemberReferenceExpr(Expr *Base, QualType BaseType, if (IsArrow) RecordTy = RecordTy->getAs<PointerType>()->getPointeeType(); if (LookupMemberExprInRecord(*this, R, SourceRange(), RecordTy->getAs<RecordType>(), - OpLoc, SS, TemplateArgs != 0)) + OpLoc, SS, TemplateArgs != nullptr)) return ExprError(); // Explicit member accesses. @@ -686,7 +686,7 @@ Sema::BuildMemberReferenceExpr(Expr *Base, QualType BaseType, ExprResult BaseResult = Owned(Base); ExprResult Result = LookupMemberExpr(R, BaseResult, IsArrow, OpLoc, - SS, /*ObjCImpDecl*/ 0, TemplateArgs != 0); + SS, /*ObjCImpDecl*/ nullptr, TemplateArgs != nullptr); if (BaseResult.isInvalid()) return ExprError(); @@ -842,16 +842,13 @@ BuildMSPropertyRefExpr(Sema &S, Expr *BaseExpr, bool IsArrow, } /// \brief Build a MemberExpr AST node. -static MemberExpr *BuildMemberExpr(Sema &SemaRef, - ASTContext &C, Expr *Base, bool isArrow, - const CXXScopeSpec &SS, - SourceLocation TemplateKWLoc, - ValueDecl *Member, - DeclAccessPair FoundDecl, - const DeclarationNameInfo &MemberNameInfo, - QualType Ty, - ExprValueKind VK, ExprObjectKind OK, - const TemplateArgumentListInfo *TemplateArgs = 0) { +static MemberExpr * +BuildMemberExpr(Sema &SemaRef, ASTContext &C, Expr *Base, bool isArrow, + const CXXScopeSpec &SS, SourceLocation TemplateKWLoc, + ValueDecl *Member, DeclAccessPair FoundDecl, + const DeclarationNameInfo &MemberNameInfo, QualType Ty, + ExprValueKind VK, ExprObjectKind OK, + const TemplateArgumentListInfo *TemplateArgs = nullptr) { assert((!isArrow || Base->isRValue()) && "-> base must be a pointer rvalue"); MemberExpr *E = MemberExpr::Create(C, Base, isArrow, SS.getWithLocInContext(C), @@ -1222,7 +1219,7 @@ Sema::LookupMemberExpr(LookupResult &R, ExprResult &BaseExpr, // Returning valid-but-null is how we indicate to the caller that // the lookup result was filled in. - return Owned((Expr*) 0); + return Owned((Expr*) nullptr); } // Handle ivar access to Objective-C objects. @@ -1261,8 +1258,8 @@ Sema::LookupMemberExpr(LookupResult &R, ExprResult &BaseExpr, if (RequireCompleteType(OpLoc, BaseType, diag::err_typecheck_incomplete_tag, BaseExpr.get())) return ExprError(); - - ObjCInterfaceDecl *ClassDeclared = 0; + + ObjCInterfaceDecl *ClassDeclared = nullptr; ObjCIvarDecl *IV = IDecl->lookupInstanceVariable(Member, ClassDeclared); if (!IV) { @@ -1270,9 +1267,9 @@ Sema::LookupMemberExpr(LookupResult &R, ExprResult &BaseExpr, DeclFilterCCC<ObjCIvarDecl> Validator; Validator.IsObjCIvarLookup = IsArrow; if (TypoCorrection Corrected = CorrectTypo(R.getLookupNameInfo(), - LookupMemberName, NULL, NULL, - Validator, CTK_ErrorRecovery, - IDecl)) { + LookupMemberName, nullptr, + nullptr, Validator, + CTK_ErrorRecovery, IDecl)) { IV = Corrected.getCorrectionDeclAs<ObjCIvarDecl>(); diagnoseTypo(Corrected, PDiag(diag::err_typecheck_member_reference_ivar_suggest) @@ -1313,7 +1310,7 @@ Sema::LookupMemberExpr(LookupResult &R, ExprResult &BaseExpr, return ExprError(); if (IV->getAccessControl() != ObjCIvarDecl::Public && IV->getAccessControl() != ObjCIvarDecl::Package) { - ObjCInterfaceDecl *ClassOfMethodDecl = 0; + ObjCInterfaceDecl *ClassOfMethodDecl = nullptr; if (ObjCMethodDecl *MD = getCurMethodDecl()) ClassOfMethodDecl = MD->getClassInterface(); else if (ObjCImpDecl && getCurFunctionDecl()) { @@ -1431,8 +1428,9 @@ Sema::LookupMemberExpr(LookupResult &R, ExprResult &BaseExpr, SelectorTable::constructSetterSelector(PP.getIdentifierTable(), PP.getSelectorTable(), Member); - ObjCMethodDecl *SMD = 0; - if (Decl *SDecl = FindGetterSetterNameDecl(OPT, /*Property id*/0, + ObjCMethodDecl *SMD = nullptr; + if (Decl *SDecl = FindGetterSetterNameDecl(OPT, + /*Property id*/nullptr, SetterSel, Context)) SMD = dyn_cast<ObjCMethodDecl>(SDecl); @@ -1622,7 +1620,7 @@ ExprResult Sema::ActOnMemberAccessExpr(Scope *S, Expr *Base, bool IsArrow = (OpKind == tok::arrow); NamedDecl *FirstQualifierInScope - = (!SS.isSet() ? 0 : FindFirstQualifierInScope(S, SS.getScopeRep())); + = (!SS.isSet() ? nullptr : FindFirstQualifierInScope(S, SS.getScopeRep())); // This is a postfix expression, so get rid of ParenListExprs. ExprResult Result = MaybeConvertParenListExprToParenExpr(S, Base); @@ -1639,7 +1637,7 @@ ExprResult Sema::ActOnMemberAccessExpr(Scope *S, Expr *Base, LookupResult R(*this, NameInfo, LookupMemberName); ExprResult BaseResult = Owned(Base); Result = LookupMemberExpr(R, BaseResult, IsArrow, OpLoc, - SS, ObjCImpDecl, TemplateArgs != 0); + SS, ObjCImpDecl, TemplateArgs != nullptr); if (BaseResult.isInvalid()) return ExprError(); Base = BaseResult.take(); @@ -1752,8 +1750,8 @@ Sema::BuildImplicitMemberExpr(const CXXScopeSpec &SS, // 'this' expression now. QualType ThisTy = getCurrentThisType(); assert(!ThisTy.isNull() && "didn't correctly pre-flight capture of 'this'"); - - Expr *baseExpr = 0; // null signifies implicit access + + Expr *baseExpr = nullptr; // null signifies implicit access if (IsKnownInstance) { SourceLocation Loc = R.getNameLoc(); if (SS.getRange().isValid()) @@ -1761,11 +1759,11 @@ Sema::BuildImplicitMemberExpr(const CXXScopeSpec &SS, CheckCXXThisCapture(Loc); baseExpr = new (Context) CXXThisExpr(loc, ThisTy, /*isImplicit=*/true); } - + return BuildMemberReferenceExpr(baseExpr, ThisTy, /*OpLoc*/ SourceLocation(), /*IsArrow*/ true, SS, TemplateKWLoc, - /*FirstQualifierInScope*/ 0, + /*FirstQualifierInScope*/ nullptr, R, TemplateArgs); } |