[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/Sema/SemaStmt.cpp b/lib/Sema/SemaStmt.cpp
index 718a7e6..5df1a50 100644
--- a/lib/Sema/SemaStmt.cpp
+++ b/lib/Sema/SemaStmt.cpp
@@ -2748,7 +2748,7 @@
}
StmtResult Sema::ActOnMSAsmStmt(SourceLocation AsmLoc,
- SmallVectorImpl<Token> &AsmToks,
+ ArrayRef<Token> AsmToks,
std::string &AsmString,
SourceLocation EndLoc) {
// MS-style inline assembly is not fully supported, so emit a warning.
diff --git a/lib/Sema/TreeTransform.h b/lib/Sema/TreeTransform.h
index 71af263..76cd51f 100644
--- a/lib/Sema/TreeTransform.h
+++ b/lib/Sema/TreeTransform.h
@@ -1185,7 +1185,7 @@
/// By default, performs semantic analysis to build the new statement.
/// Subclasses may override this routine to provide different behavior.
StmtResult RebuildMSAsmStmt(SourceLocation AsmLoc,
- SmallVectorImpl<Token> &AsmToks,
+ ArrayRef<Token> AsmToks,
std::string &AsmString,
SourceLocation EndLoc) {
return getSema().ActOnMSAsmStmt(AsmLoc, AsmToks, AsmString, EndLoc);
@@ -5610,9 +5610,11 @@
template<typename Derived>
StmtResult
TreeTransform<Derived>::TransformMSAsmStmt(MSAsmStmt *S) {
+ ArrayRef<Token> AsmToks =
+ llvm::makeArrayRef(S->getAsmToks(), S->getNumAsmToks());
// No need to transform the asm string literal.
return getDerived().RebuildMSAsmStmt(S->getAsmLoc(),
- S->getAsmToks(),
+ AsmToks,
*S->getAsmString(),
S->getEndLoc());
}