ParsedType &CastTy,
SourceRange &CastRange);
- typedef SmallVector<SourceLocation, 20> CommaLocsTy;
-
/// ParseExpressionList - Used for C/C++ (argument-)expression-list.
bool ParseExpressionList(SmallVectorImpl<Expr *> &Exprs,
- SmallVectorImpl<SourceLocation> &CommaLocs,
llvm::function_ref<void()> ExpressionStarts =
llvm::function_ref<void()>(),
bool FailImmediatelyOnInvalidExpr = false,
/// ParseSimpleExpressionList - A simple comma-separated list of expressions,
/// used for misc language extensions.
- bool ParseSimpleExpressionList(SmallVectorImpl<Expr*> &Exprs,
- SmallVectorImpl<SourceLocation> &CommaLocs);
-
+ bool ParseSimpleExpressionList(SmallVectorImpl<Expr *> &Exprs);
/// ParenParseOption - Control what ParseParenExpression will parse.
enum ParenParseOption {
? Sema::ExpressionEvaluationContext::Unevaluated
: Sema::ExpressionEvaluationContext::ConstantEvaluated);
- CommaLocsTy CommaLocs;
ExprVector ParsedExprs;
- if (ParseExpressionList(ParsedExprs, CommaLocs,
- llvm::function_ref<void()>(),
+ if (ParseExpressionList(ParsedExprs, llvm::function_ref<void()>(),
/*FailImmediatelyOnInvalidExpr=*/true,
/*EarlyTypoCorrection=*/true)) {
SkipUntil(tok::r_paren, StopAtSemi);
T.consumeOpen();
ExprVector Exprs;
- CommaLocsTy CommaLocs;
InitializerScopeRAII InitScope(*this, D, ThisDecl);
// ProduceConstructorSignatureHelp only on VarDecls.
ExpressionStarts = SetPreferredType;
}
- if (ParseExpressionList(Exprs, CommaLocs, ExpressionStarts)) {
+ if (ParseExpressionList(Exprs, ExpressionStarts)) {
if (ThisVarDecl && PP.isCodeCompletionReached() && !CalledSignatureHelp) {
Actions.ProduceConstructorSignatureHelp(
ThisVarDecl->getType()->getCanonicalTypeInternal(),
} else {
// Match the ')'.
T.consumeClose();
-
- assert(!Exprs.empty() && Exprs.size()-1 == CommaLocs.size() &&
- "Unexpected number of commas!");
-
InitScope.pop();
ExprResult Initializer = Actions.ActOnParenListExpr(T.getOpenLocation(),
// Parse the optional expression-list.
ExprVector ArgExprs;
- CommaLocsTy CommaLocs;
auto RunSignatureHelp = [&] {
if (TemplateTypeTy.isInvalid())
return QualType();
CalledSignatureHelp = true;
return PreferredType;
};
- if (Tok.isNot(tok::r_paren) &&
- ParseExpressionList(ArgExprs, CommaLocs, [&] {
+ if (Tok.isNot(tok::r_paren) && ParseExpressionList(ArgExprs, [&] {
PreferredType.enterFunctionArgument(Tok.getLocation(),
RunSignatureHelp);
})) {
ArgExprs.push_back(Idx.get());
}
} else if (Tok.isNot(tok::r_square)) {
- CommaLocsTy CommaLocs;
- if (ParseExpressionList(ArgExprs, CommaLocs)) {
+ if (ParseExpressionList(ArgExprs)) {
LHS = Actions.CorrectDelayedTyposInExpr(LHS);
HasError = true;
}
- assert(
- (ArgExprs.empty() || ArgExprs.size() == CommaLocs.size() + 1) &&
- "Unexpected number of commas!");
}
}
if (OpKind == tok::lesslessless) {
ExprVector ExecConfigExprs;
- CommaLocsTy ExecConfigCommaLocs;
SourceLocation OpenLoc = ConsumeToken();
- if (ParseSimpleExpressionList(ExecConfigExprs, ExecConfigCommaLocs)) {
+ if (ParseSimpleExpressionList(ExecConfigExprs)) {
(void)Actions.CorrectDelayedTyposInExpr(LHS);
LHS = ExprError();
}
}
ExprVector ArgExprs;
- CommaLocsTy CommaLocs;
auto RunSignatureHelp = [&]() -> QualType {
QualType PreferredType = Actions.ProduceCallSignatureHelp(
LHS.get(), ArgExprs, PT.getOpenLocation());
};
if (OpKind == tok::l_paren || !LHS.isInvalid()) {
if (Tok.isNot(tok::r_paren)) {
- if (ParseExpressionList(ArgExprs, CommaLocs, [&] {
+ if (ParseExpressionList(ArgExprs, [&] {
PreferredType.enterFunctionArgument(Tok.getLocation(),
RunSignatureHelp);
})) {
PT.consumeClose();
LHS = ExprError();
} else {
- assert(
- (ArgExprs.size() == 0 || ArgExprs.size() - 1 == CommaLocs.size()) &&
- "Unexpected number of commas!");
Expr *Fn = LHS.get();
SourceLocation RParLoc = Tok.getLocation();
LHS = Actions.ActOnCallExpr(getCurScope(), Fn, Loc, ArgExprs, RParLoc,
} else if (isTypeCast) {
// Parse the expression-list.
InMessageExpressionRAIIObject InMessage(*this, false);
-
ExprVector ArgExprs;
- CommaLocsTy CommaLocs;
- if (!ParseSimpleExpressionList(ArgExprs, CommaLocs)) {
+ if (!ParseSimpleExpressionList(ArgExprs)) {
// FIXME: If we ever support comma expressions as operands to
// fold-expressions, we'll need to allow multiple ArgExprs here.
if (ExprType >= FoldExpr && ArgExprs.size() == 1 &&
/// [C++0x] braced-init-list
/// \endverbatim
bool Parser::ParseExpressionList(SmallVectorImpl<Expr *> &Exprs,
- SmallVectorImpl<SourceLocation> &CommaLocs,
llvm::function_ref<void()> ExpressionStarts,
bool FailImmediatelyOnInvalidExpr,
bool EarlyTypoCorrection) {
break;
// Move to the next argument, remember where the comma was.
Token Comma = Tok;
- CommaLocs.push_back(ConsumeToken());
-
+ ConsumeToken();
checkPotentialAngleBracketDelimiter(Comma);
}
if (SawError) {
/// assignment-expression
/// simple-expression-list , assignment-expression
/// \endverbatim
-bool
-Parser::ParseSimpleExpressionList(SmallVectorImpl<Expr*> &Exprs,
- SmallVectorImpl<SourceLocation> &CommaLocs) {
+bool Parser::ParseSimpleExpressionList(SmallVectorImpl<Expr *> &Exprs) {
while (true) {
ExprResult Expr = ParseAssignmentExpression();
if (Expr.isInvalid())
// Move to the next argument, remember where the comma was.
Token Comma = Tok;
- CommaLocs.push_back(ConsumeToken());
-
+ ConsumeToken();
checkPotentialAngleBracketDelimiter(Comma);
}
}
InitKind = LambdaCaptureInitKind::DirectInit;
ExprVector Exprs;
- CommaLocsTy Commas;
if (Tentative) {
Parens.skipToEnd();
*Tentative = LambdaIntroducerTentativeParse::Incomplete;
- } else if (ParseExpressionList(Exprs, Commas)) {
+ } else if (ParseExpressionList(Exprs)) {
Parens.skipToEnd();
Init = ExprError();
} else {
PreferredType.enterTypeCast(Tok.getLocation(), TypeRep.get());
ExprVector Exprs;
- CommaLocsTy CommaLocs;
auto RunSignatureHelp = [&]() {
QualType PreferredType;
};
if (Tok.isNot(tok::r_paren)) {
- if (ParseExpressionList(Exprs, CommaLocs, [&] {
+ if (ParseExpressionList(Exprs, [&] {
PreferredType.enterFunctionArgument(Tok.getLocation(),
RunSignatureHelp);
})) {
if (!TypeRep)
return ExprError();
- assert((Exprs.size() == 0 || Exprs.size()-1 == CommaLocs.size())&&
- "Unexpected number of commas!");
return Actions.ActOnCXXTypeConstructExpr(TypeRep, T.getOpenLocation(),
Exprs, T.getCloseLocation(),
/*ListInitialization=*/false);
T.consumeOpen();
ConstructorLParen = T.getOpenLocation();
if (Tok.isNot(tok::r_paren)) {
- CommaLocsTy CommaLocs;
auto RunSignatureHelp = [&]() {
ParsedType TypeRep =
Actions.ActOnTypeName(getCurScope(), DeclaratorInfo).get();
CalledSignatureHelp = true;
return PreferredType;
};
- if (ParseExpressionList(ConstructorArgs, CommaLocs, [&] {
+ if (ParseExpressionList(ConstructorArgs, [&] {
PreferredType.enterFunctionArgument(Tok.getLocation(),
RunSignatureHelp);
})) {
}
// It's not a type, it has to be an expression list.
- // Discard the comma locations - ActOnCXXNew has enough parameters.
- CommaLocsTy CommaLocs;
- return ParseExpressionList(PlacementArgs, CommaLocs);
+ return ParseExpressionList(PlacementArgs);
}
/// ParseCXXDeleteExpression - Parse a C++ delete-expression. Delete is used
T.consumeOpen();
ExprVector Exprs;
- CommaLocsTy CommaLocs;
SourceLocation LParLoc = T.getOpenLocation();
auto RunSignatureHelp = [this, OmpPrivParm, LParLoc, &Exprs]() {
CalledSignatureHelp = true;
return PreferredType;
};
- if (ParseExpressionList(Exprs, CommaLocs, [&] {
+ if (ParseExpressionList(Exprs, [&] {
PreferredType.enterFunctionArgument(Tok.getLocation(),
RunSignatureHelp);
})) {
if (!T.consumeClose())
RLoc = T.getCloseLocation();
- assert(!Exprs.empty() && Exprs.size() - 1 == CommaLocs.size() &&
- "Unexpected number of commas!");
-
ExprResult Initializer =
Actions.ActOnParenListExpr(T.getOpenLocation(), RLoc, Exprs);
Actions.AddInitializerToDecl(OmpPrivParm, Initializer.get(),