diff options
| author | Reid Kleckner <reid@kleckner.net> | 2013-12-17 19:46:40 +0000 |
|---|---|---|
| committer | Reid Kleckner <reid@kleckner.net> | 2013-12-17 19:46:40 +0000 |
| commit | 395336de591e50191eb5c41d4ca1f3b68517a014 (patch) | |
| tree | bfca3d237fe98c71b2a2764c26e07c6c6811802f /lib/CodeGen/CodeGenFunction.cpp | |
| parent | 0f00360fd725214622d05082824a5dcc47d44e1c (diff) | |
| download | clang-395336de591e50191eb5c41d4ca1f3b68517a014.tar.gz clang-395336de591e50191eb5c41d4ca1f3b68517a014.tar.bz2 clang-395336de591e50191eb5c41d4ca1f3b68517a014.tar.xz | |
[ms-cxxabi] The 'most derived' ctor parameter usually comes last
Unlike Itanium's VTTs, the 'most derived' boolean or bitfield is the
last parameter for non-variadic constructors, rather than the second.
For variadic constructors, the 'most derived' parameter comes after the
'this' parameter. This affects constructor calls and constructor decls
in a variety of places.
Reviewers: timurrrr
Differential Revision: http://llvm-reviews.chandlerc.com/D2405
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@197518 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CodeGenFunction.cpp')
| -rw-r--r-- | lib/CodeGen/CodeGenFunction.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/CodeGen/CodeGenFunction.cpp b/lib/CodeGen/CodeGenFunction.cpp index ce2c9b05c4..46e2edd916 100644 --- a/lib/CodeGen/CodeGenFunction.cpp +++ b/lib/CodeGen/CodeGenFunction.cpp @@ -694,16 +694,19 @@ void CodeGenFunction::GenerateCode(GlobalDecl GD, llvm::Function *Fn, QualType ResTy = FD->getResultType(); CurGD = GD; - const CXXMethodDecl *MD; - if ((MD = dyn_cast<CXXMethodDecl>(FD)) && MD->isInstance()) { + const CXXMethodDecl *MD = dyn_cast<CXXMethodDecl>(FD); + if (MD && MD->isInstance()) { if (CGM.getCXXABI().HasThisReturn(GD)) ResTy = MD->getThisType(getContext()); - CGM.getCXXABI().BuildInstanceFunctionParams(*this, ResTy, Args); + CGM.getCXXABI().buildThisParam(*this, Args); } for (unsigned i = 0, e = FD->getNumParams(); i != e; ++i) Args.push_back(FD->getParamDecl(i)); + if (MD && (isa<CXXConstructorDecl>(MD) || isa<CXXDestructorDecl>(MD))) + CGM.getCXXABI().addImplicitStructorParams(*this, ResTy, Args); + SourceRange BodyRange; if (Stmt *Body = FD->getBody()) BodyRange = Body->getSourceRange(); CurEHLocation = BodyRange.getEnd(); |
