forked from OSchip/llvm-project
Fix for PR5707: make sure implicit copy constructors initialize the vtable
pointer. llvm-svn: 90840
This commit is contained in:
parent
897bc03305
commit
bb5008a32a
|
@ -1572,6 +1572,8 @@ CodeGenFunction::SynthesizeCXXCopyConstructor(const CXXConstructorDecl *Ctor,
|
|||
EmitAggregateCopy(LHS.getAddress(), RHS.getAddress(), Field->getType());
|
||||
}
|
||||
}
|
||||
|
||||
InitializeVtablePtrs(ClassDecl);
|
||||
FinishFunction();
|
||||
}
|
||||
|
||||
|
@ -1812,6 +1814,10 @@ void CodeGenFunction::EmitCtorPrologue(const CXXConstructorDecl *CD,
|
|||
PopCXXTemporary();
|
||||
}
|
||||
|
||||
InitializeVtablePtr(ClassDecl);
|
||||
}
|
||||
|
||||
void CodeGenFunction::InitializeVtablePtrs(const CXXRecordDecl *ClassDecl) {
|
||||
if (!ClassDecl->isDynamicClass())
|
||||
return;
|
||||
|
||||
|
|
|
@ -468,6 +468,8 @@ public:
|
|||
|
||||
void EmitCtorPrologue(const CXXConstructorDecl *CD, CXXCtorType Type);
|
||||
|
||||
void InitializeVtablePtrs(const CXXRecordDecl *ClassDecl);
|
||||
|
||||
void SynthesizeCXXCopyConstructor(const CXXConstructorDecl *Ctor,
|
||||
CXXCtorType Type,
|
||||
llvm::Function *Fn,
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
// RUN: clang-cc -emit-llvm -o - %s | FileCheck %s
|
||||
|
||||
struct A { virtual void a(); };
|
||||
A x(A& y) { return y; }
|
||||
|
||||
// CHECK: define linkonce_odr void @_ZN1AC1ERKS_(
|
||||
// CHECK: store i8** getelementptr inbounds ([3 x i8*]* @_ZTV1A, i64 0, i64 2)
|
Loading…
Reference in New Issue