summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/MicrosoftCXXABI.cpp
diff options
context:
space:
mode:
authorDavid Majnemer <david.majnemer@gmail.com>2014-09-11 23:05:02 +0000
committerDavid Majnemer <david.majnemer@gmail.com>2014-09-11 23:05:02 +0000
commit196ac334f32f81d9fe040d51de4117c86c7087bf (patch)
tree1ed72f0ee4a978653049c6ecf2be7dc0b266250d /clang/lib/CodeGen/MicrosoftCXXABI.cpp
parent42fa4af8fe4e672d0b8bd4a5ebeec9b45730a0ff (diff)
downloadbcm5719-llvm-196ac334f32f81d9fe040d51de4117c86c7087bf.tar.gz
bcm5719-llvm-196ac334f32f81d9fe040d51de4117c86c7087bf.zip
MS ABI: Use the correct this arg when generating implict copy ctor
We assumed that the incoming this argument would be the last argument. However, this is not true under the MS ABI. This fixes PR20897. llvm-svn: 217642
Diffstat (limited to 'clang/lib/CodeGen/MicrosoftCXXABI.cpp')
-rw-r--r--clang/lib/CodeGen/MicrosoftCXXABI.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/MicrosoftCXXABI.cpp b/clang/lib/CodeGen/MicrosoftCXXABI.cpp
index 173099a6bba..04b7ea08edc 100644
--- a/clang/lib/CodeGen/MicrosoftCXXABI.cpp
+++ b/clang/lib/CodeGen/MicrosoftCXXABI.cpp
@@ -50,6 +50,18 @@ public:
bool isSRetParameterAfterThis() const override { return true; }
+ size_t getSrcArgforCopyCtor(const CXXConstructorDecl *CD,
+ FunctionArgList &Args) const override {
+ assert(Args.size() >= 2 &&
+ "expected the arglist to have at least two args!");
+ // The 'most_derived' parameter goes second if the ctor is variadic and
+ // has v-bases.
+ if (CD->getParent()->getNumVBases() > 0 &&
+ CD->getType()->castAs<FunctionProtoType>()->isVariadic())
+ return 2;
+ return 1;
+ }
+
StringRef GetPureVirtualCallName() override { return "_purecall"; }
// No known support for deleted functions in MSVC yet, so this choice is
// arbitrary.
OpenPOWER on IntegriCloud