diff options
author | John McCall <rjmccall@apple.com> | 2010-05-26 22:34:26 +0000 |
---|---|---|
committer | John McCall <rjmccall@apple.com> | 2010-05-26 22:34:26 +0000 |
commit | 23f6626262895d5307e2398e3377dc38c978ea43 (patch) | |
tree | 8b1567291e5ed1bd2a79b4c5958a02582a651293 /clang/lib/CodeGen/CGClass.cpp | |
parent | 084bcb1322e5e8f5e71bd2e8eab1ae541e9aeaff (diff) | |
download | bcm5719-llvm-23f6626262895d5307e2398e3377dc38c978ea43.tar.gz bcm5719-llvm-23f6626262895d5307e2398e3377dc38c978ea43.zip |
Correctly pass aggregates by reference when emitting thunks.
llvm-svn: 104778
Diffstat (limited to 'clang/lib/CodeGen/CGClass.cpp')
-rw-r--r-- | clang/lib/CodeGen/CGClass.cpp | 27 |
1 files changed, 1 insertions, 26 deletions
diff --git a/clang/lib/CodeGen/CGClass.cpp b/clang/lib/CodeGen/CGClass.cpp index 587a68beb22..bebea549f96 100644 --- a/clang/lib/CodeGen/CGClass.cpp +++ b/clang/lib/CodeGen/CGClass.cpp @@ -1137,34 +1137,9 @@ CodeGenFunction::EmitDelegateCXXConstructorCall(const CXXConstructorDecl *Ctor, // Explicit arguments. for (; I != E; ++I) { - const VarDecl *Param = I->first; QualType ArgType = Param->getType(); // because we're passing it to itself - - // StartFunction converted the ABI-lowered parameter(s) into a - // local alloca. We need to turn that into an r-value suitable - // for EmitCall. - llvm::Value *Local = GetAddrOfLocalVar(Param); - RValue Arg; - - // For the most part, we just need to load the alloca, except: - // 1) aggregate r-values are actually pointers to temporaries, and - // 2) references to aggregates are pointers directly to the aggregate. - // I don't know why references to non-aggregates are different here. - if (ArgType->isReferenceType()) { - const ReferenceType *RefType = ArgType->getAs<ReferenceType>(); - if (hasAggregateLLVMType(RefType->getPointeeType())) - Arg = RValue::getAggregate(Local); - else - // Locals which are references to scalars are represented - // with allocas holding the pointer. - Arg = RValue::get(Builder.CreateLoad(Local)); - } else { - if (hasAggregateLLVMType(ArgType)) - Arg = RValue::getAggregate(Local); - else - Arg = RValue::get(EmitLoadOfScalar(Local, false, ArgType)); - } + RValue Arg = EmitDelegateCallArg(Param); DelegateArgs.push_back(std::make_pair(Arg, ArgType)); } |