diff options
Diffstat (limited to 'lib/Sema/SemaDeclCXX.cpp')
-rw-r--r-- | lib/Sema/SemaDeclCXX.cpp | 31 |
1 files changed, 18 insertions, 13 deletions
diff --git a/lib/Sema/SemaDeclCXX.cpp b/lib/Sema/SemaDeclCXX.cpp index 7ed9bfc..0d7cbf4 100644 --- a/lib/Sema/SemaDeclCXX.cpp +++ b/lib/Sema/SemaDeclCXX.cpp @@ -73,8 +73,8 @@ namespace { /// VisitExpr - Visit all of the children of this expression. bool CheckDefaultArgumentVisitor::VisitExpr(Expr *Node) { bool IsInvalid = false; - for (Stmt::child_range I = Node->children(); I; ++I) - IsInvalid |= Visit(*I); + for (Stmt *SubStmt : Node->children()) + IsInvalid |= Visit(SubStmt); return IsInvalid; } @@ -1091,9 +1091,9 @@ CheckConstexprFunctionStmt(Sema &SemaRef, const FunctionDecl *Dcl, Stmt *S, break; if (!Cxx1yLoc.isValid()) Cxx1yLoc = S->getLocStart(); - for (Stmt::child_range Children = S->children(); Children; ++Children) - if (*Children && - !CheckConstexprFunctionStmt(SemaRef, Dcl, *Children, ReturnStmts, + for (Stmt *SubStmt : S->children()) + if (SubStmt && + !CheckConstexprFunctionStmt(SemaRef, Dcl, SubStmt, ReturnStmts, Cxx1yLoc)) return false; return true; @@ -1106,9 +1106,9 @@ CheckConstexprFunctionStmt(Sema &SemaRef, const FunctionDecl *Dcl, Stmt *S, // mutation, we can reasonably allow them in C++11 as an extension. if (!Cxx1yLoc.isValid()) Cxx1yLoc = S->getLocStart(); - for (Stmt::child_range Children = S->children(); Children; ++Children) - if (*Children && - !CheckConstexprFunctionStmt(SemaRef, Dcl, *Children, ReturnStmts, + for (Stmt *SubStmt : S->children()) + if (SubStmt && + !CheckConstexprFunctionStmt(SemaRef, Dcl, SubStmt, ReturnStmts, Cxx1yLoc)) return false; return true; @@ -2186,9 +2186,6 @@ Sema::ActOnCXXMemberDeclarator(Scope *S, AccessSpecifier AS, Declarator &D, assert(Member && "HandleField never returns null"); } } else { - assert(InitStyle == ICIS_NoInit || - D.getDeclSpec().getStorageClassSpec() == DeclSpec::SCS_static); - Member = HandleDeclarator(S, D, TemplateParameterLists); if (!Member) return nullptr; @@ -12890,8 +12887,7 @@ void Sema::SetDeclDefaulted(Decl *Dcl, SourceLocation DefaultLoc) { } static void SearchForReturnInStmt(Sema &Self, Stmt *S) { - for (Stmt::child_range CI = S->children(); CI; ++CI) { - Stmt *SubStmt = *CI; + for (Stmt *SubStmt : S->children()) { if (!SubStmt) continue; if (isa<ReturnStmt>(SubStmt)) @@ -13060,6 +13056,15 @@ bool Sema::CheckPureMethod(CXXMethodDecl *Method, SourceRange InitRange) { return true; } +void Sema::ActOnPureSpecifier(Decl *D, SourceLocation ZeroLoc) { + if (D->getFriendObjectKind()) + Diag(D->getLocation(), diag::err_pure_friend); + else if (auto *M = dyn_cast<CXXMethodDecl>(D)) + CheckPureMethod(M, ZeroLoc); + else + Diag(D->getLocation(), diag::err_illegal_initializer); +} + /// \brief Determine whether the given declaration is a static data member. static bool isStaticDataMember(const Decl *D) { if (const VarDecl *Var = dyn_cast_or_null<VarDecl>(D)) |