From 27b2c9a3529375989156bf8a50801b831a911ea5 Mon Sep 17 00:00:00 2001 From: Robert Wilhelm Date: Mon, 19 Aug 2013 20:51:20 +0000 Subject: [PATCH] const'ify Sema::ActOnCompoundStmt by changing Parameter of Sema::ActOnCompoundStmt from MutableArrayRef to ArrayRef. No functionality change intended. llvm-svn: 188705 --- clang/include/clang/Sema/Sema.h | 3 +-- clang/lib/Parse/ParseStmt.cpp | 6 ++---- clang/lib/Sema/SemaDeclCXX.cpp | 18 +++++++----------- clang/lib/Sema/SemaStmt.cpp | 13 +++++-------- 4 files changed, 15 insertions(+), 25 deletions(-) diff --git a/clang/include/clang/Sema/Sema.h b/clang/include/clang/Sema/Sema.h index f7d5b6b..a871e55 100644 --- a/clang/include/clang/Sema/Sema.h +++ b/clang/include/clang/Sema/Sema.h @@ -2799,8 +2799,7 @@ public: void ActOnStartOfCompoundStmt(); void ActOnFinishOfCompoundStmt(); StmtResult ActOnCompoundStmt(SourceLocation L, SourceLocation R, - MultiStmtArg Elts, - bool isStmtExpr); + ArrayRef Elts, bool isStmtExpr); /// \brief A RAII object to enter scope of a compound statement. class CompoundScopeRAII { diff --git a/clang/lib/Parse/ParseStmt.cpp b/clang/lib/Parse/ParseStmt.cpp index b038910..3b6a265 100644 --- a/clang/lib/Parse/ParseStmt.cpp +++ b/clang/lib/Parse/ParseStmt.cpp @@ -2394,8 +2394,7 @@ Decl *Parser::ParseFunctionStatementBody(Decl *Decl, ParseScope &BodyScope) { // If the function body could not be parsed, make a bogus compoundstmt. if (FnBody.isInvalid()) { Sema::CompoundScopeRAII CompoundScope(Actions); - FnBody = Actions.ActOnCompoundStmt(LBraceLoc, LBraceLoc, - MultiStmtArg(), false); + FnBody = Actions.ActOnCompoundStmt(LBraceLoc, LBraceLoc, None, false); } BodyScope.Exit(); @@ -2432,8 +2431,7 @@ Decl *Parser::ParseFunctionTryBlock(Decl *Decl, ParseScope &BodyScope) { // compound statement as the body. if (FnBody.isInvalid()) { Sema::CompoundScopeRAII CompoundScope(Actions); - FnBody = Actions.ActOnCompoundStmt(LBraceLoc, LBraceLoc, - MultiStmtArg(), false); + FnBody = Actions.ActOnCompoundStmt(LBraceLoc, LBraceLoc, None, false); } BodyScope.Exit(); diff --git a/clang/lib/Sema/SemaDeclCXX.cpp b/clang/lib/Sema/SemaDeclCXX.cpp index b4b8340..528396d 100644 --- a/clang/lib/Sema/SemaDeclCXX.cpp +++ b/clang/lib/Sema/SemaDeclCXX.cpp @@ -9798,13 +9798,11 @@ void Sema::DefineImplicitCopyConstructor(SourceLocation CurrentLocation, CopyConstructor->setInvalidDecl(); } else { Sema::CompoundScopeRAII CompoundScope(*this); - CopyConstructor->setBody(ActOnCompoundStmt(CopyConstructor->getLocation(), - CopyConstructor->getLocation(), - MultiStmtArg(), - /*isStmtExpr=*/false) - .takeAs()); + CopyConstructor->setBody(ActOnCompoundStmt( + CopyConstructor->getLocation(), CopyConstructor->getLocation(), None, + /*isStmtExpr=*/ false).takeAs()); } - + CopyConstructor->setUsed(); if (ASTMutationListener *L = getASTMutationListener()) { L->CompletedImplicitDefinition(CopyConstructor); @@ -9987,11 +9985,9 @@ void Sema::DefineImplicitMoveConstructor(SourceLocation CurrentLocation, MoveConstructor->setInvalidDecl(); } else { Sema::CompoundScopeRAII CompoundScope(*this); - MoveConstructor->setBody(ActOnCompoundStmt(MoveConstructor->getLocation(), - MoveConstructor->getLocation(), - MultiStmtArg(), - /*isStmtExpr=*/false) - .takeAs()); + MoveConstructor->setBody(ActOnCompoundStmt( + MoveConstructor->getLocation(), MoveConstructor->getLocation(), None, + /*isStmtExpr=*/ false).takeAs()); } MoveConstructor->setUsed(); diff --git a/clang/lib/Sema/SemaStmt.cpp b/clang/lib/Sema/SemaStmt.cpp index 87e7e03..5b21c93 100644 --- a/clang/lib/Sema/SemaStmt.cpp +++ b/clang/lib/Sema/SemaStmt.cpp @@ -291,11 +291,10 @@ sema::CompoundScopeInfo &Sema::getCurCompoundScope() const { return getCurFunction()->CompoundScopes.back(); } -StmtResult -Sema::ActOnCompoundStmt(SourceLocation L, SourceLocation R, - MultiStmtArg elts, bool isStmtExpr) { - unsigned NumElts = elts.size(); - Stmt **Elts = elts.data(); +StmtResult Sema::ActOnCompoundStmt(SourceLocation L, SourceLocation R, + ArrayRef Elts, bool isStmtExpr) { + const unsigned NumElts = Elts.size(); + // If we're in C89 mode, check that we don't have any decls after stmts. If // so, emit an extension diagnostic. if (!getLangOpts().C99 && !getLangOpts().CPlusPlus) { @@ -332,9 +331,7 @@ Sema::ActOnCompoundStmt(SourceLocation L, SourceLocation R, DiagnoseEmptyLoopBody(Elts[i], Elts[i + 1]); } - return Owned(new (Context) CompoundStmt(Context, - llvm::makeArrayRef(Elts, NumElts), - L, R)); + return Owned(new (Context) CompoundStmt(Context, Elts, L, R)); } StmtResult -- 2.7.4