<< Arg->getSourceRange()))
return true;
- // Pass the argument.
- if (FDecl && i < FDecl->getNumParams()) {
- ParmVarDecl *Param = FDecl->getParamDecl(i);
- InitializedEntity Entity =InitializedEntity::InitializeParameter(Param);
- OwningExprResult ArgE = PerformCopyInitialization(Entity,
- SourceLocation(),
- Owned(Arg));
- if (ArgE.isInvalid())
- return true;
-
- Arg = ArgE.takeAs<Expr>();
- } else {
- if (PerformCopyInitialization(Arg, ProtoArgType, AA_Passing))
- return true;
- }
+ // Pass the argument
+ ParmVarDecl *Param = 0;
+ if (FDecl && i < FDecl->getNumParams())
+ Param = FDecl->getParamDecl(i);
+
+
+ InitializedEntity Entity =
+ Param? InitializedEntity::InitializeParameter(Param)
+ : InitializedEntity::InitializeParameter(ProtoArgType);
+ OwningExprResult ArgE = PerformCopyInitialization(Entity,
+ SourceLocation(),
+ Owned(Arg));
+ if (ArgE.isInvalid())
+ return true;
+
+ Arg = ArgE.takeAs<Expr>();
if (!ProtoArgType->isReferenceType())
Arg = MaybeBindToTemporary(Arg).takeAs<Expr>();
: Kind(EK_Parameter), Parent(0), Type(Parm->getType()),
VariableOrMember(reinterpret_cast<DeclaratorDecl*>(Parm)) { }
- /// \brief Create the initialization entity for the result of a function,
- /// throwing an object, or performing an explicit cast.
+ /// \brief Create the initialization entity for the result of a
+ /// function, throwing an object, performing an explicit cast, or
+ /// initializing a parameter for which there is no declaration.
InitializedEntity(EntityKind Kind, SourceLocation Loc, QualType Type)
: Kind(Kind), Parent(0), Type(Type), Location(Loc.getRawEncoding()) { }
return InitializedEntity(Parm);
}
+ /// \brief Create the initialization entity for a parameter that is
+ /// only known by its type.
+ static InitializedEntity InitializeParameter(QualType Type) {
+ return InitializedEntity(EK_Parameter, SourceLocation(), Type);
+ }
+
/// \brief Create the initialization entity for the result of a function.
static InitializedEntity InitializeResult(SourceLocation ReturnLoc,
QualType Type) {