summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/Stmt.cpp
diff options
context:
space:
mode:
authorNico Weber <nicolasweber@gmx.de>2012-12-29 20:03:39 +0000
committerNico Weber <nicolasweber@gmx.de>2012-12-29 20:03:39 +0000
commita2a0eb940aebf6c548f8cd650c0a98333383bd15 (patch)
tree1df666843d9c2322694e58e33fc7f5a91f8f9891 /clang/lib/AST/Stmt.cpp
parentfe82eb6bcd973fe4c6ea68ba661cb56715b42358 (diff)
downloadbcm5719-llvm-a2a0eb940aebf6c548f8cd650c0a98333383bd15.tar.gz
bcm5719-llvm-a2a0eb940aebf6c548f8cd650c0a98333383bd15.zip
ArrayRefize a CompoundStmt constructor.
llvm-svn: 171238
Diffstat (limited to 'clang/lib/AST/Stmt.cpp')
-rw-r--r--clang/lib/AST/Stmt.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/clang/lib/AST/Stmt.cpp b/clang/lib/AST/Stmt.cpp
index 1ef80c95c40..ac6d224fae5 100644
--- a/clang/lib/AST/Stmt.cpp
+++ b/clang/lib/AST/Stmt.cpp
@@ -251,20 +251,20 @@ SourceLocation Stmt::getLocEnd() const {
llvm_unreachable("unknown statement kind");
}
-CompoundStmt::CompoundStmt(ASTContext &C, Stmt **StmtStart, unsigned NumStmts,
+CompoundStmt::CompoundStmt(ASTContext &C, ArrayRef<Stmt*> Stmts,
SourceLocation LB, SourceLocation RB)
: Stmt(CompoundStmtClass), LBracLoc(LB), RBracLoc(RB) {
- CompoundStmtBits.NumStmts = NumStmts;
- assert(CompoundStmtBits.NumStmts == NumStmts &&
+ CompoundStmtBits.NumStmts = Stmts.size();
+ assert(CompoundStmtBits.NumStmts == Stmts.size() &&
"NumStmts doesn't fit in bits of CompoundStmtBits.NumStmts!");
- if (NumStmts == 0) {
+ if (Stmts.size() == 0) {
Body = 0;
return;
}
- Body = new (C) Stmt*[NumStmts];
- memcpy(Body, StmtStart, NumStmts * sizeof(*Body));
+ Body = new (C) Stmt*[Stmts.size()];
+ std::copy(Stmts.begin(), Stmts.end(), Body);
}
void CompoundStmt::setStmts(ASTContext &C, Stmt **Stmts, unsigned NumStmts) {
OpenPOWER on IntegriCloud