зеркало из https://github.com/microsoft/clang-1.git
ArrayRef'ize GenericSelectionExpr
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181592 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Родитель
0ca318bbad
Коммит
8061322dab
|
@ -3144,15 +3144,14 @@ public:
|
|||
SourceLocation DefaultLoc,
|
||||
SourceLocation RParenLoc,
|
||||
Expr *ControllingExpr,
|
||||
MultiTypeArg ArgTypes,
|
||||
MultiExprArg ArgExprs);
|
||||
ArrayRef<ParsedType> ArgTypes,
|
||||
ArrayRef<Expr *> ArgExprs);
|
||||
ExprResult CreateGenericSelectionExpr(SourceLocation KeyLoc,
|
||||
SourceLocation DefaultLoc,
|
||||
SourceLocation RParenLoc,
|
||||
Expr *ControllingExpr,
|
||||
TypeSourceInfo **Types,
|
||||
Expr **Exprs,
|
||||
unsigned NumAssocs);
|
||||
ArrayRef<TypeSourceInfo *> Types,
|
||||
ArrayRef<Expr *> Exprs);
|
||||
|
||||
// Binary/Unary Operators. 'Tok' is the token for the operator.
|
||||
ExprResult CreateBuiltinUnaryOp(SourceLocation OpLoc, UnaryOperatorKind Opc,
|
||||
|
|
|
@ -1230,25 +1230,23 @@ Sema::ActOnGenericSelectionExpr(SourceLocation KeyLoc,
|
|||
SourceLocation DefaultLoc,
|
||||
SourceLocation RParenLoc,
|
||||
Expr *ControllingExpr,
|
||||
MultiTypeArg ArgTypes,
|
||||
MultiExprArg ArgExprs) {
|
||||
ArrayRef<ParsedType> ArgTypes,
|
||||
ArrayRef<Expr *> ArgExprs) {
|
||||
unsigned NumAssocs = ArgTypes.size();
|
||||
assert(NumAssocs == ArgExprs.size());
|
||||
|
||||
ParsedType *ParsedTypes = ArgTypes.data();
|
||||
Expr **Exprs = ArgExprs.data();
|
||||
|
||||
TypeSourceInfo **Types = new TypeSourceInfo*[NumAssocs];
|
||||
for (unsigned i = 0; i < NumAssocs; ++i) {
|
||||
if (ParsedTypes[i])
|
||||
(void) GetTypeFromParser(ParsedTypes[i], &Types[i]);
|
||||
if (ArgTypes[i])
|
||||
(void) GetTypeFromParser(ArgTypes[i], &Types[i]);
|
||||
else
|
||||
Types[i] = 0;
|
||||
}
|
||||
|
||||
ExprResult ER = CreateGenericSelectionExpr(KeyLoc, DefaultLoc, RParenLoc,
|
||||
ControllingExpr, Types, Exprs,
|
||||
NumAssocs);
|
||||
ControllingExpr,
|
||||
llvm::makeArrayRef(Types, NumAssocs),
|
||||
ArgExprs);
|
||||
delete [] Types;
|
||||
return ER;
|
||||
}
|
||||
|
@ -1258,9 +1256,10 @@ Sema::CreateGenericSelectionExpr(SourceLocation KeyLoc,
|
|||
SourceLocation DefaultLoc,
|
||||
SourceLocation RParenLoc,
|
||||
Expr *ControllingExpr,
|
||||
TypeSourceInfo **Types,
|
||||
Expr **Exprs,
|
||||
unsigned NumAssocs) {
|
||||
ArrayRef<TypeSourceInfo *> Types,
|
||||
ArrayRef<Expr *> Exprs) {
|
||||
unsigned NumAssocs = Types.size();
|
||||
assert(NumAssocs == Exprs.size());
|
||||
if (ControllingExpr->getType()->isPlaceholderType()) {
|
||||
ExprResult result = CheckPlaceholderExpr(ControllingExpr);
|
||||
if (result.isInvalid()) return ExprError();
|
||||
|
@ -1328,8 +1327,7 @@ Sema::CreateGenericSelectionExpr(SourceLocation KeyLoc,
|
|||
if (IsResultDependent)
|
||||
return Owned(new (Context) GenericSelectionExpr(
|
||||
Context, KeyLoc, ControllingExpr,
|
||||
llvm::makeArrayRef(Types, NumAssocs),
|
||||
llvm::makeArrayRef(Exprs, NumAssocs),
|
||||
Types, Exprs,
|
||||
DefaultLoc, RParenLoc, ContainsUnexpandedParameterPack));
|
||||
|
||||
SmallVector<unsigned, 1> CompatIndices;
|
||||
|
@ -1384,8 +1382,7 @@ Sema::CreateGenericSelectionExpr(SourceLocation KeyLoc,
|
|||
|
||||
return Owned(new (Context) GenericSelectionExpr(
|
||||
Context, KeyLoc, ControllingExpr,
|
||||
llvm::makeArrayRef(Types, NumAssocs),
|
||||
llvm::makeArrayRef(Exprs, NumAssocs),
|
||||
Types, Exprs,
|
||||
DefaultLoc, RParenLoc, ContainsUnexpandedParameterPack,
|
||||
ResultIndex));
|
||||
}
|
||||
|
|
|
@ -1767,12 +1767,10 @@ public:
|
|||
SourceLocation DefaultLoc,
|
||||
SourceLocation RParenLoc,
|
||||
Expr *ControllingExpr,
|
||||
TypeSourceInfo **Types,
|
||||
Expr **Exprs,
|
||||
unsigned NumAssocs) {
|
||||
ArrayRef<TypeSourceInfo *> Types,
|
||||
ArrayRef<Expr *> Exprs) {
|
||||
return getSema().CreateGenericSelectionExpr(KeyLoc, DefaultLoc, RParenLoc,
|
||||
ControllingExpr, Types, Exprs,
|
||||
NumAssocs);
|
||||
ControllingExpr, Types, Exprs);
|
||||
}
|
||||
|
||||
/// \brief Build a new overloaded operator call expression.
|
||||
|
@ -6289,9 +6287,8 @@ TreeTransform<Derived>::TransformGenericSelectionExpr(GenericSelectionExpr *E) {
|
|||
E->getDefaultLoc(),
|
||||
E->getRParenLoc(),
|
||||
ControllingExpr.release(),
|
||||
AssocTypes.data(),
|
||||
AssocExprs.data(),
|
||||
E->getNumAssocs());
|
||||
AssocTypes,
|
||||
AssocExprs);
|
||||
}
|
||||
|
||||
template<typename Derived>
|
||||
|
|
Загрузка…
Ссылка в новой задаче