зеркало из https://github.com/microsoft/clang-1.git
Fix delegating constructors stylistic issues.
Material bugfixes to come this afternoon. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130782 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Родитель
2a053a3370
Коммит
d49bd5515b
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче