summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/Stmt.cpp
diff options
context:
space:
mode:
authorChad Rosier <mcrosier@apple.com>2012-08-07 00:29:06 +0000
committerChad Rosier <mcrosier@apple.com>2012-08-07 00:29:06 +0000
commit99fc38191b9f466fb7d44c1fddf49e766f2de565 (patch)
treeef9efe9bf1ef91d54d44b6d613a354d396d1a10a /clang/lib/AST/Stmt.cpp
parent754cedf23fa4451f98b2d529a9b954acd14a4738 (diff)
downloadbcm5719-llvm-99fc38191b9f466fb7d44c1fddf49e766f2de565.tar.gz
bcm5719-llvm-99fc38191b9f466fb7d44c1fddf49e766f2de565.zip
[ms-inline asm] Stmt destructors are never called, so allocate the AsmToks using
the ASTContext BumpPtr. Also use the preferred llvm::ArrayRef interface. llvm-svn: 161373
Diffstat (limited to 'clang/lib/AST/Stmt.cpp')
-rw-r--r--clang/lib/AST/Stmt.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/clang/lib/AST/Stmt.cpp b/clang/lib/AST/Stmt.cpp
index 763f8bd33a3..5e7a13e09d9 100644
--- a/clang/lib/AST/Stmt.cpp
+++ b/clang/lib/AST/Stmt.cpp
@@ -584,13 +584,14 @@ AsmStmt::AsmStmt(ASTContext &C, SourceLocation asmloc, bool issimple,
}
MSAsmStmt::MSAsmStmt(ASTContext &C, SourceLocation asmloc,
- SmallVectorImpl<Token> &asmtoks,
+ ArrayRef<Token> asmtoks,
std::string &asmstr, SourceLocation endloc)
: Stmt(MSAsmStmtClass), AsmLoc(asmloc), EndLoc(endloc),
- AsmToks(asmtoks.size()), AsmStr(asmstr),
- IsSimple(true), IsVolatile(true) {
- for (unsigned i = 0, e = asmtoks.size(); i != e; ++i)
- AsmToks.push_back(asmtoks[i]);
+ AsmStr(asmstr), IsSimple(true), IsVolatile(true), NumAsmToks(asmtoks.size()) {
+
+ AsmToks = new (C) Token[NumAsmToks];
+ for (unsigned i = 0, e = NumAsmToks; i != e; ++i)
+ AsmToks[i] = asmtoks[i];
}
ObjCForCollectionStmt::ObjCForCollectionStmt(Stmt *Elem, Expr *Collect,
OpenPOWER on IntegriCloud