[cfe-commits] r130782 - in /cfe/trunk/lib: CodeGen/CGClass.cpp CodeGen/CGExprCXX.cpp Sema/SemaInit.cpp
Sean Hunt
scshunt at csclub.uwaterloo.ca
Tue May 3 13:19:28 PDT 2011
Author: coppro
Date: Tue May 3 15:19:28 2011
New Revision: 130782
URL: http://llvm.org/viewvc/llvm-project?rev=130782&view=rev
Log:
Fix delegating constructors stylistic issues.
Material bugfixes to come this afternoon.
Modified:
cfe/trunk/lib/CodeGen/CGClass.cpp
cfe/trunk/lib/CodeGen/CGExprCXX.cpp
cfe/trunk/lib/Sema/SemaInit.cpp
Modified: cfe/trunk/lib/CodeGen/CGClass.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGClass.cpp?rev=130782&r1=130781&r2=130782&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGClass.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGClass.cpp Tue May 3 15:19:28 2011
@@ -726,12 +726,13 @@
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);
Modified: cfe/trunk/lib/CodeGen/CGExprCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExprCXX.cpp?rev=130782&r1=130781&r2=130782&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGExprCXX.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGExprCXX.cpp Tue May 3 15:19:28 2011
@@ -404,17 +404,25 @@
}
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(),
Modified: cfe/trunk/lib/Sema/SemaInit.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaInit.cpp?rev=130782&r1=130781&r2=130782&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaInit.cpp (original)
+++ cfe/trunk/lib/Sema/SemaInit.cpp Tue May 3 15:19:28 2011
@@ -4060,8 +4060,7 @@
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;
}
More information about the cfe-commits
mailing list