[ms-inline asm] Stmt destructors are never called, so allocate the AsmToks using
the ASTContext BumpPtr. Also use the preferred llvm::ArrayRef interface.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161373 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/AST/Stmt.cpp b/lib/AST/Stmt.cpp
index 763f8bd..5e7a13e 100644
--- a/lib/AST/Stmt.cpp
+++ b/lib/AST/Stmt.cpp
@@ -584,13 +584,14 @@
}
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,