diff options
author | Douglas Gregor <dgregor@apple.com> | 2009-12-22 07:24:36 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2009-12-22 07:24:36 +0000 |
commit | aa0373107968aa7a26bf63f4a2673b8325b800af (patch) | |
tree | 8d3242d7f6b67a72a3eddffee790f83047bb7b12 /lib/Sema/SemaExpr.cpp | |
parent | 8257d411a759b91921681c3b7f79e50e0d9252db (diff) |
Switch initialization of parameters in a call over to
InitializationSequence (when a FunctionDecl is present). This required
a few small fixes to initialization sequences:
- Make sure to use the adjusted parameter type for initialization of
function parameters.
- Implement transparent union calling semantics in C
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91902 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaExpr.cpp')
-rw-r--r-- | lib/Sema/SemaExpr.cpp | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp index 181d6d1c8f..718d5ab577 100644 --- a/lib/Sema/SemaExpr.cpp +++ b/lib/Sema/SemaExpr.cpp @@ -3182,8 +3182,20 @@ bool Sema::GatherArgumentsForCall(SourceLocation CallLoc, return true; // Pass the argument. - if (PerformCopyInitialization(Arg, ProtoArgType, AA_Passing)) - return true; + 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; + } if (!ProtoArgType->isReferenceType()) Arg = MaybeBindToTemporary(Arg).takeAs<Expr>(); |