From: Robert Wilhelm Date: Thu, 22 Aug 2013 09:20:03 +0000 (+0000) Subject: const'ify Sema::ActOnCXXTryBlock by X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=21adb0ce21d8180b5dce0a31209cba3a5a33e26a;p=clang const'ify Sema::ActOnCXXTryBlock by changing Parameter from MutableArrayRef to ArrayRef. No functionality change intended. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@188994 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/clang/Sema/Sema.h b/include/clang/Sema/Sema.h index 7ff52b3fea..70d4ce493f 100644 --- a/include/clang/Sema/Sema.h +++ b/include/clang/Sema/Sema.h @@ -2980,11 +2980,10 @@ public: StmtResult ActOnCXXCatchBlock(SourceLocation CatchLoc, Decl *ExDecl, Stmt *HandlerBlock); StmtResult ActOnCXXTryBlock(SourceLocation TryLoc, Stmt *TryBlock, - MultiStmtArg Handlers); + ArrayRef Handlers); StmtResult ActOnSEHTryBlock(bool IsCXXTry, // try (true) or __try (false) ? - SourceLocation TryLoc, - Stmt *TryBlock, + SourceLocation TryLoc, Stmt *TryBlock, Stmt *Handler); StmtResult ActOnSEHExceptBlock(SourceLocation Loc, diff --git a/lib/Parse/ParseStmt.cpp b/lib/Parse/ParseStmt.cpp index 0638e915fe..16da1e0c9d 100644 --- a/lib/Parse/ParseStmt.cpp +++ b/lib/Parse/ParseStmt.cpp @@ -2542,7 +2542,7 @@ StmtResult Parser::ParseCXXTryBlockCommon(SourceLocation TryLoc, bool FnTry) { if (Handlers.empty()) return StmtError(); - return Actions.ActOnCXXTryBlock(TryLoc, TryBlock.take(),Handlers); + return Actions.ActOnCXXTryBlock(TryLoc, TryBlock.take(), Handlers); } } diff --git a/lib/Sema/SemaStmt.cpp b/lib/Sema/SemaStmt.cpp index 5434e987e9..c53b31a692 100644 --- a/lib/Sema/SemaStmt.cpp +++ b/lib/Sema/SemaStmt.cpp @@ -3057,18 +3057,16 @@ public: /// ActOnCXXTryBlock - Takes a try compound-statement and a number of /// handlers and creates a try statement from them. -StmtResult -Sema::ActOnCXXTryBlock(SourceLocation TryLoc, Stmt *TryBlock, - MultiStmtArg RawHandlers) { +StmtResult Sema::ActOnCXXTryBlock(SourceLocation TryLoc, Stmt *TryBlock, + ArrayRef Handlers) { // Don't report an error if 'try' is used in system headers. if (!getLangOpts().CXXExceptions && !getSourceManager().isInSystemHeader(TryLoc)) Diag(TryLoc, diag::err_exceptions_disabled) << "try"; - unsigned NumHandlers = RawHandlers.size(); + const unsigned NumHandlers = Handlers.size(); assert(NumHandlers > 0 && "The parser shouldn't call this if there are no handlers."); - Stmt **Handlers = RawHandlers.data(); SmallVector TypesWithHandlers; @@ -3116,8 +3114,7 @@ Sema::ActOnCXXTryBlock(SourceLocation TryLoc, Stmt *TryBlock, // Neither of these are explicitly forbidden, but every compiler detects them // and warns. - return Owned(CXXTryStmt::Create(Context, TryLoc, TryBlock, - llvm::makeArrayRef(Handlers, NumHandlers))); + return Owned(CXXTryStmt::Create(Context, TryLoc, TryBlock, Handlers)); } StmtResult diff --git a/lib/Sema/TreeTransform.h b/lib/Sema/TreeTransform.h index 6e69bdc512..164bb89d0b 100644 --- a/lib/Sema/TreeTransform.h +++ b/lib/Sema/TreeTransform.h @@ -1387,9 +1387,8 @@ public: /// /// By default, performs semantic analysis to build the new statement. /// Subclasses may override this routine to provide different behavior. - StmtResult RebuildCXXTryStmt(SourceLocation TryLoc, - Stmt *TryBlock, - MultiStmtArg Handlers) { + StmtResult RebuildCXXTryStmt(SourceLocation TryLoc, Stmt *TryBlock, + ArrayRef Handlers) { return getSema().ActOnCXXTryBlock(TryLoc, TryBlock, Handlers); }