forked from OSchip/llvm-project
Make the CXXDefaultArgExpr constructor protected and add a static Create function.
llvm-svn: 79013
This commit is contained in:
parent
52b7f0ad5f
commit
e827123f08
|
@ -382,14 +382,20 @@ public:
|
|||
/// supply arguments for all of the parameters.
|
||||
class CXXDefaultArgExpr : public Expr {
|
||||
ParmVarDecl *Param;
|
||||
|
||||
protected:
|
||||
CXXDefaultArgExpr(StmtClass SC, ParmVarDecl *param)
|
||||
: Expr(SC, param->hasUnparsedDefaultArg() ?
|
||||
param->getType().getNonReferenceType()
|
||||
: param->getDefaultArg()->getType()),
|
||||
Param(param) { }
|
||||
|
||||
public:
|
||||
// Param is the parameter whose default argument is used by this
|
||||
// expression.
|
||||
explicit CXXDefaultArgExpr(ParmVarDecl *param)
|
||||
: Expr(CXXDefaultArgExprClass,
|
||||
param->hasUnparsedDefaultArg()? param->getType().getNonReferenceType()
|
||||
: param->getDefaultArg()->getType()),
|
||||
Param(param) { }
|
||||
static CXXDefaultArgExpr *Create(ASTContext &C, ParmVarDecl *Param) {
|
||||
return new (C) CXXDefaultArgExpr(CXXDefaultArgExprClass, Param);
|
||||
}
|
||||
|
||||
// Retrieve the parameter that the argument was created from.
|
||||
const ParmVarDecl *getParam() const { return Param; }
|
||||
|
|
|
@ -2394,7 +2394,7 @@ Expr *Sema::BuildCXXConstructExpr(ASTContext &C,
|
|||
for (unsigned I = 0, N = E->getNumTemporaries(); I != N; ++I)
|
||||
ExprTemporaries.push_back(E->getTemporary(I));
|
||||
}
|
||||
Expr *Arg = new (C) CXXDefaultArgExpr(FDecl->getParamDecl(j));
|
||||
Expr *Arg = CXXDefaultArgExpr::Create(C, FDecl->getParamDecl(j));
|
||||
Temp->setArg(j, Arg);
|
||||
}
|
||||
return Temp;
|
||||
|
|
|
@ -2657,7 +2657,7 @@ Sema::ConvertArgumentsForCall(CallExpr *Call, Expr *Fn,
|
|||
}
|
||||
|
||||
// We already type-checked the argument, so we know it works.
|
||||
Arg = new (Context) CXXDefaultArgExpr(FDecl->getParamDecl(i));
|
||||
Arg = CXXDefaultArgExpr::Create(Context, FDecl->getParamDecl(i));
|
||||
}
|
||||
|
||||
QualType ArgType = Arg->getType();
|
||||
|
|
|
@ -4531,7 +4531,7 @@ Sema::BuildCallToObjectOfClassType(Scope *S, Expr *Object,
|
|||
QualType ProtoArgType = Proto->getArgType(i);
|
||||
IsError |= PerformCopyInitialization(Arg, ProtoArgType, "passing");
|
||||
} else {
|
||||
Arg = new (Context) CXXDefaultArgExpr(Method->getParamDecl(i));
|
||||
Arg = CXXDefaultArgExpr::Create(Context, Method->getParamDecl(i));
|
||||
}
|
||||
|
||||
TheCall->setArg(i + 1, Arg);
|
||||
|
|
|
@ -1021,7 +1021,7 @@ public:
|
|||
/// require any semantic analysis. Subclasses may override this routine to
|
||||
/// provide different behavior.
|
||||
OwningExprResult RebuildCXXDefaultArgExpr(ParmVarDecl *Param) {
|
||||
return getSema().Owned(new (getSema().Context) CXXDefaultArgExpr(Param));
|
||||
return getSema().Owned(CXXDefaultArgExpr::Create(getSema().Context, Param));
|
||||
}
|
||||
|
||||
/// \brief Build a new C++ zero-initialization expression.
|
||||
|
|
Loading…
Reference in New Issue