[cfe-commits] r171239 - in /cfe/trunk: include/clang/AST/StmtCXX.h lib/AST/Stmt.cpp lib/Sema/SemaStmt.cpp
Nico Weber
nicolasweber at gmx.de
Sat Dec 29 12:13:03 PST 2012
Author: nico
Date: Sat Dec 29 14:13:03 2012
New Revision: 171239
URL: http://llvm.org/viewvc/llvm-project?rev=171239&view=rev
Log:
ArrayRefize CXXTryStmt.
Modified:
cfe/trunk/include/clang/AST/StmtCXX.h
cfe/trunk/lib/AST/Stmt.cpp
cfe/trunk/lib/Sema/SemaStmt.cpp
Modified: cfe/trunk/include/clang/AST/StmtCXX.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/StmtCXX.h?rev=171239&r1=171238&r2=171239&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/StmtCXX.h (original)
+++ cfe/trunk/include/clang/AST/StmtCXX.h Sat Dec 29 14:13:03 2012
@@ -63,8 +63,7 @@
SourceLocation TryLoc;
unsigned NumHandlers;
- CXXTryStmt(SourceLocation tryLoc, Stmt *tryBlock, Stmt **handlers,
- unsigned numHandlers);
+ CXXTryStmt(SourceLocation tryLoc, Stmt *tryBlock, ArrayRef<Stmt*> handlers);
CXXTryStmt(EmptyShell Empty, unsigned numHandlers)
: Stmt(CXXTryStmtClass), NumHandlers(numHandlers) { }
@@ -78,8 +77,7 @@
public:
static CXXTryStmt *Create(ASTContext &C, SourceLocation tryLoc,
- Stmt *tryBlock, Stmt **handlers,
- unsigned numHandlers);
+ Stmt *tryBlock, ArrayRef<Stmt*> handlers);
static CXXTryStmt *Create(ASTContext &C, EmptyShell Empty,
unsigned numHandlers);
Modified: cfe/trunk/lib/AST/Stmt.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/Stmt.cpp?rev=171239&r1=171238&r2=171239&view=diff
==============================================================================
--- cfe/trunk/lib/AST/Stmt.cpp (original)
+++ cfe/trunk/lib/AST/Stmt.cpp Sat Dec 29 14:13:03 2012
@@ -769,13 +769,12 @@
}
CXXTryStmt *CXXTryStmt::Create(ASTContext &C, SourceLocation tryLoc,
- Stmt *tryBlock, Stmt **handlers,
- unsigned numHandlers) {
+ Stmt *tryBlock, ArrayRef<Stmt*> handlers) {
std::size_t Size = sizeof(CXXTryStmt);
- Size += ((numHandlers + 1) * sizeof(Stmt));
+ Size += ((handlers.size() + 1) * sizeof(Stmt));
void *Mem = C.Allocate(Size, llvm::alignOf<CXXTryStmt>());
- return new (Mem) CXXTryStmt(tryLoc, tryBlock, handlers, numHandlers);
+ return new (Mem) CXXTryStmt(tryLoc, tryBlock, handlers);
}
CXXTryStmt *CXXTryStmt::Create(ASTContext &C, EmptyShell Empty,
@@ -788,11 +787,11 @@
}
CXXTryStmt::CXXTryStmt(SourceLocation tryLoc, Stmt *tryBlock,
- Stmt **handlers, unsigned numHandlers)
- : Stmt(CXXTryStmtClass), TryLoc(tryLoc), NumHandlers(numHandlers) {
+ ArrayRef<Stmt*> handlers)
+ : Stmt(CXXTryStmtClass), TryLoc(tryLoc), NumHandlers(handlers.size()) {
Stmt **Stmts = reinterpret_cast<Stmt **>(this + 1);
Stmts[0] = tryBlock;
- std::copy(handlers, handlers + NumHandlers, Stmts + 1);
+ std::copy(handlers.begin(), handlers.end(), Stmts + 1);
}
CXXForRangeStmt::CXXForRangeStmt(DeclStmt *Range, DeclStmt *BeginEndStmt,
Modified: cfe/trunk/lib/Sema/SemaStmt.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaStmt.cpp?rev=171239&r1=171238&r2=171239&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaStmt.cpp (original)
+++ cfe/trunk/lib/Sema/SemaStmt.cpp Sat Dec 29 14:13:03 2012
@@ -2757,7 +2757,7 @@
// and warns.
return Owned(CXXTryStmt::Create(Context, TryLoc, TryBlock,
- Handlers, NumHandlers));
+ llvm::makeArrayRef(Handlers, NumHandlers)));
}
StmtResult
More information about the cfe-commits
mailing list