mirror of
https://github.com/intel/llvm.git
synced 2026-01-31 16:29:50 +08:00
Fix delegating constructors stylistic issues.
Material bugfixes to come this afternoon. llvm-svn: 130782
This commit is contained in:
@@ -726,12 +726,13 @@ void CodeGenFunction::EmitCtorPrologue(const CXXConstructorDecl *CD,
|
||||
B != E; ++B) {
|
||||
CXXCtorInitializer *Member = (*B);
|
||||
|
||||
if (Member->isBaseInitializer())
|
||||
if (Member->isBaseInitializer()) {
|
||||
EmitBaseInitializer(*this, ClassDecl, Member, CtorType);
|
||||
else if (Member->isAnyMemberInitializer())
|
||||
} else {
|
||||
assert(Member->isAnyMemberInitializer() &&
|
||||
"Delegating initializer on non-delegating constructor");
|
||||
MemberInitializers.push_back(Member);
|
||||
else
|
||||
llvm_unreachable("Delegating initializer on non-delegating constructor");
|
||||
}
|
||||
}
|
||||
|
||||
InitializeVTablePointers(ClassDecl);
|
||||
|
||||
@@ -404,17 +404,25 @@ CodeGenFunction::EmitCXXConstructExpr(const CXXConstructExpr *E,
|
||||
}
|
||||
else {
|
||||
CXXCtorType Type;
|
||||
CXXConstructExpr::ConstructionKind K = E->getConstructionKind();
|
||||
if (K == CXXConstructExpr::CK_Delegating) {
|
||||
bool ForVirtualBase = false;
|
||||
|
||||
switch (E->getConstructionKind()) {
|
||||
case CXXConstructExpr::CK_Delegating:
|
||||
// We should be emitting a constructor; GlobalDecl will assert this
|
||||
Type = CurGD.getCtorType();
|
||||
} else {
|
||||
Type = (E->getConstructionKind() == CXXConstructExpr::CK_Complete)
|
||||
? Ctor_Complete : Ctor_Base;
|
||||
}
|
||||
break;
|
||||
|
||||
bool ForVirtualBase =
|
||||
E->getConstructionKind() == CXXConstructExpr::CK_VirtualBase;
|
||||
case CXXConstructExpr::CK_Complete:
|
||||
Type = Ctor_Complete;
|
||||
break;
|
||||
|
||||
case CXXConstructExpr::CK_VirtualBase:
|
||||
ForVirtualBase = true;
|
||||
// fall-through
|
||||
|
||||
case CXXConstructExpr::CK_NonVirtualBase:
|
||||
Type = Ctor_Base;
|
||||
}
|
||||
|
||||
// Call the constructor.
|
||||
EmitCXXConstructorCall(CD, Type, ForVirtualBase, Dest.getAddr(),
|
||||
|
||||
@@ -4060,8 +4060,7 @@ InitializationSequence::Perform(Sema &S,
|
||||
ConstructKind = Entity.getBaseSpecifier()->isVirtual() ?
|
||||
CXXConstructExpr::CK_VirtualBase :
|
||||
CXXConstructExpr::CK_NonVirtualBase;
|
||||
}
|
||||
if (Entity.getKind() == InitializedEntity::EK_Delegating) {
|
||||
} else if (Entity.getKind() == InitializedEntity::EK_Delegating) {
|
||||
ConstructKind = CXXConstructExpr::CK_Delegating;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user