diff options
author | Douglas Gregor <dgregor@apple.com> | 2009-12-22 16:09:06 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2009-12-22 16:09:06 +0000 |
commit | bbeb5c391ca99b71ccb39df0aa7bc3197e66e0a6 (patch) | |
tree | c064d3177b3d7df344d596bccd97157bfce9f03f /clang/lib/Sema/SemaExpr.cpp | |
parent | 1b3039344b1ed7814fad8539f04bd6fdf0d89536 (diff) | |
download | bcm5719-llvm-bbeb5c391ca99b71ccb39df0aa7bc3197e66e0a6.tar.gz bcm5719-llvm-bbeb5c391ca99b71ccb39df0aa7bc3197e66e0a6.zip |
Switch parameter-passing for calls via function pointers (where we
don't have a FunctionDecl) over to InitializationSequence.
llvm-svn: 91906
Diffstat (limited to 'clang/lib/Sema/SemaExpr.cpp')
-rw-r--r-- | clang/lib/Sema/SemaExpr.cpp | 31 |
1 files changed, 16 insertions, 15 deletions
diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp index d01516c77fe..09e1d6f4551 100644 --- a/clang/lib/Sema/SemaExpr.cpp +++ b/clang/lib/Sema/SemaExpr.cpp @@ -3181,21 +3181,22 @@ bool Sema::GatherArgumentsForCall(SourceLocation CallLoc, << 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>(); |