diff options
Diffstat (limited to 'lib/Sema/SemaPseudoObject.cpp')
-rw-r--r-- | lib/Sema/SemaPseudoObject.cpp | 44 |
1 files changed, 21 insertions, 23 deletions
diff --git a/lib/Sema/SemaPseudoObject.cpp b/lib/Sema/SemaPseudoObject.cpp index ebf1d10aa16a..06bcd8d00ded 100644 --- a/lib/Sema/SemaPseudoObject.cpp +++ b/lib/Sema/SemaPseudoObject.cpp @@ -1,9 +1,8 @@ //===--- SemaPseudoObject.cpp - Semantic Analysis for Pseudo-Objects ------===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// // @@ -141,25 +140,24 @@ namespace { unsigned resultIndex = gse->getResultIndex(); unsigned numAssocs = gse->getNumAssocs(); - SmallVector<Expr*, 8> assocs(numAssocs); - SmallVector<TypeSourceInfo*, 8> assocTypes(numAssocs); - - for (unsigned i = 0; i != numAssocs; ++i) { - Expr *assoc = gse->getAssocExpr(i); - if (i == resultIndex) assoc = rebuild(assoc); - assocs[i] = assoc; - assocTypes[i] = gse->getAssocTypeSourceInfo(i); + SmallVector<Expr *, 8> assocExprs; + SmallVector<TypeSourceInfo *, 8> assocTypes; + assocExprs.reserve(numAssocs); + assocTypes.reserve(numAssocs); + + for (const GenericSelectionExpr::Association &assoc : + gse->associations()) { + Expr *assocExpr = assoc.getAssociationExpr(); + if (assoc.isSelected()) + assocExpr = rebuild(assocExpr); + assocExprs.push_back(assocExpr); + assocTypes.push_back(assoc.getTypeSourceInfo()); } - return new (S.Context) GenericSelectionExpr(S.Context, - gse->getGenericLoc(), - gse->getControllingExpr(), - assocTypes, - assocs, - gse->getDefaultLoc(), - gse->getRParenLoc(), - gse->containsUnexpandedParameterPack(), - resultIndex); + return GenericSelectionExpr::Create( + S.Context, gse->getGenericLoc(), gse->getControllingExpr(), + assocTypes, assocExprs, gse->getDefaultLoc(), gse->getRParenLoc(), + gse->containsUnexpandedParameterPack(), resultIndex); } if (ChooseExpr *ce = dyn_cast<ChooseExpr>(e)) { @@ -1493,7 +1491,7 @@ ExprResult MSPropertyOpBuilder::buildGet() { return ExprError(); } - return S.ActOnCallExpr(S.getCurScope(), GetterExpr.get(), + return S.BuildCallExpr(S.getCurScope(), GetterExpr.get(), RefExpr->getSourceRange().getBegin(), CallArgs, RefExpr->getSourceRange().getEnd()); } @@ -1525,7 +1523,7 @@ ExprResult MSPropertyOpBuilder::buildSet(Expr *op, SourceLocation sl, SmallVector<Expr*, 4> ArgExprs; ArgExprs.append(CallArgs.begin(), CallArgs.end()); ArgExprs.push_back(op); - return S.ActOnCallExpr(S.getCurScope(), SetterExpr.get(), + return S.BuildCallExpr(S.getCurScope(), SetterExpr.get(), RefExpr->getSourceRange().getBegin(), ArgExprs, op->getSourceRange().getEnd()); } |