Keep track of the locations of the element names in a TupleExpr.

As part of this, use tail allocation to reduce the memory footprint of
TupleExprs. Use factory methods to make it easier to construct.

I'll be using this information in a follow-on patch. SourceKit
probably wants it as well.


Swift SVN r17129
This commit is contained in:
Doug Gregor
2014-05-01 00:16:36 +00:00
parent 51bde1485d
commit 9cfb1b5ca4
14 changed files with 295 additions and 195 deletions

View File

@@ -626,12 +626,7 @@ static FuncDecl *makeOptionSetGetLogicValueMethod(StructDecl *optionSetDecl,
auto neRef = getOperatorRef(C, C.Id_NotEqualsOperator);
Expr *args[] = {valueRef, zero};
auto argsTuple = new (C) TupleExpr(SourceLoc(),
C.AllocateCopy(args),
nullptr,
SourceLoc(),
/*trailingClosure*/ false,
/*implicit*/ true);
auto argsTuple = TupleExpr::createImplicit(C, args, { });
auto apply = new (C) BinaryExpr(neRef, argsTuple, /*implicit*/ true);
auto ret = new (C) ReturnStmt(SourceLoc(), apply);