UnresolvedLookupExpr *ULE,
SourceLocation LParenLoc,
Expr **Args, unsigned NumArgs,
- SourceLocation *CommaLocs,
SourceLocation RParenLoc);
ExprResult CreateOverloadedUnaryOp(SourceLocation OpLoc,
ExprResult
BuildCallToMemberFunction(Scope *S, Expr *MemExpr,
SourceLocation LParenLoc, Expr **Args,
- unsigned NumArgs, SourceLocation *CommaLocs,
- SourceLocation RParenLoc);
+ unsigned NumArgs, SourceLocation RParenLoc);
ExprResult
BuildCallToObjectOfClassType(Scope *S, Expr *Object, SourceLocation LParenLoc,
Expr **Args, unsigned NumArgs,
- SourceLocation *CommaLocs,
SourceLocation RParenLoc);
ExprResult BuildOverloadedArrowExpr(Scope *S, Expr *Base,
/// This provides the location of the left/right parens and a list of comma
/// locations.
ExprResult ActOnCallExpr(Scope *S, Expr *Fn, SourceLocation LParenLoc,
- MultiExprArg Args, SourceLocation *CommaLocs,
- SourceLocation RParenLoc);
+ MultiExprArg Args, SourceLocation RParenLoc);
ExprResult BuildResolvedCallExpr(Expr *Fn, NamedDecl *NDecl,
SourceLocation LParenLoc,
Expr **Args, unsigned NumArgs,
void AddCXXDirectInitializerToDecl(Decl *Dcl,
SourceLocation LParenLoc,
MultiExprArg Exprs,
- SourceLocation *CommaLocs,
SourceLocation RParenLoc);
/// InitializeVarWithConstructor - Creates an CXXConstructExpr
ExprResult ActOnCXXTypeConstructExpr(ParsedType TypeRep,
SourceLocation LParenLoc,
MultiExprArg Exprs,
- SourceLocation *CommaLocs,
SourceLocation RParenLoc);
ExprResult BuildCXXTypeConstructExpr(TypeSourceInfo *Type,
SourceLocation IdLoc,
SourceLocation LParenLoc,
Expr **Args, unsigned NumArgs,
- SourceLocation *CommaLocs,
SourceLocation RParenLoc);
MemInitResult BuildMemberInitializer(FieldDecl *Member, Expr **Args,
Actions.AddCXXDirectInitializerToDecl(ThisDecl, LParenLoc,
move_arg(Exprs),
- CommaLocs.data(), RParenLoc);
+ RParenLoc);
}
} else {
bool TypeContainsUndeducedAuto =
return Actions.ActOnMemInitializer(ConstructorDecl, getCurScope(), SS, II,
TemplateTypeTy, IdLoc,
LParenLoc, ArgExprs.take(),
- ArgExprs.size(), CommaLocs.data(),
- RParenLoc);
+ ArgExprs.size(), RParenLoc);
}
/// ParseExceptionSpecification - Parse a C++ exception-specification
assert((ArgExprs.size() == 0 || ArgExprs.size()-1 == CommaLocs.size())&&
"Unexpected number of commas!");
LHS = Actions.ActOnCallExpr(getCurScope(), LHS.take(), Loc,
- move_arg(ArgExprs), CommaLocs.data(),
- Tok.getLocation());
+ move_arg(ArgExprs), Tok.getLocation());
}
ConsumeParen();
assert((Exprs.size() == 0 || Exprs.size()-1 == CommaLocs.size())&&
"Unexpected number of commas!");
return Actions.ActOnCXXTypeConstructExpr(TypeRep, LParenLoc, move_arg(Exprs),
- CommaLocs.data(), RParenLoc);
+ RParenLoc);
}
/// ParseCXXCondition - if/switch/while condition expression.
SourceLocation IdLoc,
SourceLocation LParenLoc,
ExprTy **Args, unsigned NumArgs,
- SourceLocation *CommaLocs,
SourceLocation RParenLoc) {
if (!ConstructorD)
return true;
// Build the call to the assignment operator.
ExprResult Call = S.BuildCallToMemberFunction(/*Scope=*/0,
- OpEqualRef.takeAs<Expr>(),
- Loc, &From, 1, 0, Loc);
+ OpEqualRef.takeAs<Expr>(),
+ Loc, &From, 1, Loc);
if (Call.isInvalid())
return StmtError();
CallArgs.push_back(To.takeAs<Expr>());
CallArgs.push_back(From.takeAs<Expr>());
CallArgs.push_back(IntegerLiteral::Create(Context, Size, SizeType, Loc));
- llvm::SmallVector<SourceLocation, 4> Commas; // FIXME: Silly
- Commas.push_back(Loc);
- Commas.push_back(Loc);
ExprResult Call = ExprError();
if (NeedsCollectableMemCpy)
Call = ActOnCallExpr(/*Scope=*/0,
CollectableMemCpyRef,
Loc, move_arg(CallArgs),
- Commas.data(), Loc);
+ Loc);
else
Call = ActOnCallExpr(/*Scope=*/0,
BuiltinMemCpyRef,
Loc, move_arg(CallArgs),
- Commas.data(), Loc);
+ Loc);
assert(!Call.isInvalid() && "Call to __builtin_memcpy cannot fail!");
Statements.push_back(Call.takeAs<Expr>());
void Sema::AddCXXDirectInitializerToDecl(Decl *RealDecl,
SourceLocation LParenLoc,
MultiExprArg Exprs,
- SourceLocation *CommaLocs,
SourceLocation RParenLoc) {
assert(Exprs.size() != 0 && Exprs.get() && "missing expressions");
<< FixItHint::CreateInsertion(Loc, "()");
ExprResult NewBase
- = ActOnCallExpr(0, BaseExpr, Loc,
- MultiExprArg(*this, 0, 0), 0, Loc);
+ = ActOnCallExpr(0, BaseExpr, Loc, MultiExprArg(*this, 0, 0), Loc);
BaseExpr = 0;
if (NewBase.isInvalid())
return ExprError();
/// locations.
ExprResult
Sema::ActOnCallExpr(Scope *S, Expr *Fn, SourceLocation LParenLoc,
- MultiExprArg args,
- SourceLocation *CommaLocs, SourceLocation RParenLoc) {
+ MultiExprArg args, SourceLocation RParenLoc) {
unsigned NumArgs = args.size();
// Since this might be a postfix expression, get rid of ParenListExprs.
// Determine whether this is a call to an object (C++ [over.call.object]).
if (Fn->getType()->isRecordType())
return Owned(BuildCallToObjectOfClassType(S, Fn, LParenLoc, Args, NumArgs,
- CommaLocs, RParenLoc));
+ RParenLoc));
Expr *NakedFn = Fn->IgnoreParens();
(void)MemE;
return BuildCallToMemberFunction(S, Fn, LParenLoc, Args, NumArgs,
- CommaLocs, RParenLoc);
+ RParenLoc);
}
// Determine whether this is a call to a member function.
NamedDecl *MemDecl = MemExpr->getMemberDecl();
if (isa<CXXMethodDecl>(MemDecl))
return BuildCallToMemberFunction(S, Fn, LParenLoc, Args, NumArgs,
- CommaLocs, RParenLoc);
+ RParenLoc);
}
// Determine whether this is a call to a pointer-to-member function.
if (isa<UnresolvedLookupExpr>(NakedFn)) {
UnresolvedLookupExpr *ULE = cast<UnresolvedLookupExpr>(NakedFn);
return BuildOverloadedCallExpr(S, Fn, ULE, LParenLoc, Args, NumArgs,
- CommaLocs, RParenLoc);
+ RParenLoc);
}
NamedDecl *NDecl = 0;
Sema::ActOnCXXTypeConstructExpr(ParsedType TypeRep,
SourceLocation LParenLoc,
MultiExprArg exprs,
- SourceLocation *CommaLocs,
SourceLocation RParenLoc) {
if (!TypeRep)
return ExprError();
MemExpr,
/*LPLoc*/ ExpectedLParenLoc,
MultiExprArg(),
- /*CommaLocs*/ 0,
/*RPLoc*/ ExpectedLParenLoc);
}
UnresolvedLookupExpr *ULE,
SourceLocation LParenLoc,
Expr **Args, unsigned NumArgs,
- SourceLocation *CommaLocs,
SourceLocation RParenLoc) {
CXXScopeSpec SS;
// an expression with non-empty lookup results, which should never
// end up here.
return SemaRef.ActOnCallExpr(/*Scope*/ 0, NewFn.take(), LParenLoc,
- MultiExprArg(Args, NumArgs),
- CommaLocs, RParenLoc);
+ MultiExprArg(Args, NumArgs), RParenLoc);
}
/// ResolveOverloadedCallFn - Given the call expression that calls Fn
Sema::BuildOverloadedCallExpr(Scope *S, Expr *Fn, UnresolvedLookupExpr *ULE,
SourceLocation LParenLoc,
Expr **Args, unsigned NumArgs,
- SourceLocation *CommaLocs,
SourceLocation RParenLoc) {
#ifndef NDEBUG
if (ULE->requiresADL()) {
// bailout out if it fails.
if (CandidateSet.empty())
return BuildRecoveryCallExpr(*this, S, Fn, ULE, LParenLoc, Args, NumArgs,
- CommaLocs, RParenLoc);
+ RParenLoc);
OverloadCandidateSet::iterator Best;
switch (CandidateSet.BestViableFunction(*this, Fn->getLocStart(), Best)) {
ExprResult
Sema::BuildCallToMemberFunction(Scope *S, Expr *MemExprE,
SourceLocation LParenLoc, Expr **Args,
- unsigned NumArgs, SourceLocation *CommaLocs,
- SourceLocation RParenLoc) {
+ unsigned NumArgs, SourceLocation RParenLoc) {
// Dig out the member expression. This holds both the object
// argument and the member function we're referring to.
Expr *NakedMemExpr = MemExprE->IgnoreParens();
Sema::BuildCallToObjectOfClassType(Scope *S, Expr *Object,
SourceLocation LParenLoc,
Expr **Args, unsigned NumArgs,
- SourceLocation *CommaLocs,
SourceLocation RParenLoc) {
assert(Object->getType()->isRecordType() && "Requires object type argument");
const RecordType *Record = Object->getType()->getAs<RecordType>();
Conv);
return ActOnCallExpr(S, CE, LParenLoc, MultiExprArg(Args, NumArgs),
- CommaLocs, RParenLoc);
+ RParenLoc);
}
CheckMemberOperatorAccess(LParenLoc, Object, 0, Best->FoundDecl);
static bool InstantiateInitializationArguments(Sema &SemaRef,
Expr **Args, unsigned NumArgs,
const MultiLevelTemplateArgumentList &TemplateArgs,
- llvm::SmallVectorImpl<SourceLocation> &FakeCommaLocs,
ASTOwningVector<Expr*> &InitArgs) {
for (unsigned I = 0; I != NumArgs; ++I) {
// When we hit the first defaulted argument, break out of the loop:
if (Arg.isInvalid())
return true;
- Expr *ArgExpr = (Expr *)Arg.get();
InitArgs.push_back(Arg.release());
-
- // FIXME: We're faking all of the comma locations. Do we need them?
- FakeCommaLocs.push_back(
- SemaRef.PP.getLocForEndOfToken(ArgExpr->getLocEnd()));
}
return false;
static bool InstantiateInitializer(Sema &S, Expr *Init,
const MultiLevelTemplateArgumentList &TemplateArgs,
SourceLocation &LParenLoc,
- llvm::SmallVector<SourceLocation, 4> &CommaLocs,
ASTOwningVector<Expr*> &NewArgs,
SourceLocation &RParenLoc) {
NewArgs.clear();
RParenLoc = ParenList->getRParenLoc();
return InstantiateInitializationArguments(S, ParenList->getExprs(),
ParenList->getNumExprs(),
- TemplateArgs, CommaLocs,
- NewArgs);
+ TemplateArgs, NewArgs);
}
if (CXXConstructExpr *Construct = dyn_cast<CXXConstructExpr>(Init)) {
if (InstantiateInitializationArguments(S,
Construct->getArgs(),
Construct->getNumArgs(),
- TemplateArgs,
- CommaLocs, NewArgs))
+ TemplateArgs, NewArgs))
return true;
// FIXME: Fake locations!
LParenLoc = S.PP.getLocForEndOfToken(Init->getLocStart());
- RParenLoc = CommaLocs.empty()? LParenLoc : CommaLocs.back();
+ RParenLoc = LParenLoc;
return false;
}
}
// Instantiate the initializer.
SourceLocation LParenLoc, RParenLoc;
- llvm::SmallVector<SourceLocation, 4> CommaLocs;
ASTOwningVector<Expr*> InitArgs(SemaRef);
if (!InstantiateInitializer(SemaRef, D->getInit(), TemplateArgs, LParenLoc,
- CommaLocs, InitArgs, RParenLoc)) {
+ InitArgs, RParenLoc)) {
// Attach the initializer to the declaration.
if (D->hasCXXDirectInitializer()) {
// Add the direct initializer to the declaration.
SemaRef.AddCXXDirectInitializerToDecl(Var,
LParenLoc,
move_arg(InitArgs),
- CommaLocs.data(),
RParenLoc);
} else if (InitArgs.size() == 1) {
Expr *Init = InitArgs.take()[0];
SourceLocation LParenLoc, RParenLoc;
ASTOwningVector<Expr*> NewArgs(*this);
- llvm::SmallVector<SourceLocation, 4> CommaLocs;
// Instantiate the initializer.
if (InstantiateInitializer(*this, Init->getInit(), TemplateArgs,
- LParenLoc, CommaLocs, NewArgs, RParenLoc)) {
+ LParenLoc, NewArgs, RParenLoc)) {
AnyErrors = true;
continue;
}
/// Subclasses may override this routine to provide different behavior.
ExprResult RebuildCallExpr(Expr *Callee, SourceLocation LParenLoc,
MultiExprArg Args,
- SourceLocation *CommaLocs,
SourceLocation RParenLoc) {
return getSema().ActOnCallExpr(/*Scope=*/0, Callee, LParenLoc,
- move(Args), CommaLocs, RParenLoc);
+ move(Args), RParenLoc);
}
/// \brief Build a new member access expression.
// Transform arguments.
bool ArgChanged = false;
ASTOwningVector<Expr*> Args(SemaRef);
- llvm::SmallVector<SourceLocation, 4> FakeCommaLocs;
for (unsigned I = 0, N = E->getNumArgs(); I != N; ++I) {
ExprResult Arg = getDerived().TransformExpr(E->getArg(I));
if (Arg.isInvalid())
return ExprError();
- // FIXME: Wrong source location information for the ','.
- FakeCommaLocs.push_back(
- SemaRef.PP.getLocForEndOfToken(E->getArg(I)->getSourceRange().getEnd()));
-
ArgChanged = ArgChanged || Arg.get() != E->getArg(I);
Args.push_back(Arg.get());
}
= ((Expr *)Callee.get())->getSourceRange().getBegin();
return getDerived().RebuildCallExpr(Callee.get(), FakeLParenLoc,
move_arg(Args),
- FakeCommaLocs.data(),
E->getRParenLoc());
}
// Transform the call arguments.
ASTOwningVector<Expr*> Args(SemaRef);
- llvm::SmallVector<SourceLocation, 4> FakeCommaLocs;
for (unsigned I = 1, N = E->getNumArgs(); I != N; ++I) {
if (getDerived().DropCallArgument(E->getArg(I)))
break;
if (Arg.isInvalid())
return ExprError();
- // FIXME: Poor source location information.
- SourceLocation FakeCommaLoc
- = SemaRef.PP.getLocForEndOfToken(
- static_cast<Expr *>(Arg.get())->getLocEnd());
- FakeCommaLocs.push_back(FakeCommaLoc);
Args.push_back(Arg.release());
}
return getDerived().RebuildCallExpr(Object.get(), FakeLParenLoc,
move_arg(Args),
- FakeCommaLocs.data(),
E->getLocEnd());
}