aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/CGClass.cpp
diff options
context:
space:
mode:
authorJohn McCall <rjmccall@apple.com>2010-05-21 01:18:57 +0000
committerJohn McCall <rjmccall@apple.com>2010-05-21 01:18:57 +0000
commita9976d3b192690db20f59dc44099ac4ca939bdb7 (patch)
treed803c7b2d650841a32cf0b36c87c68adfd47faaa /lib/CodeGen/CGClass.cpp
parentbc365c53606ab90537576cb48d93a54ce3fb0cb5 (diff)
When emitting an lvalue for an anonymous struct or union member during
class initialization, drill down through an arbitrary number of anonymous records. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104310 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGClass.cpp')
-rw-r--r--lib/CodeGen/CGClass.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/CodeGen/CGClass.cpp b/lib/CodeGen/CGClass.cpp
index 72d95b8556..82c72288d9 100644
--- a/lib/CodeGen/CGClass.cpp
+++ b/lib/CodeGen/CGClass.cpp
@@ -446,13 +446,15 @@ static void EmitMemberInitializer(CodeGenFunction &CGF,
QualType FieldType = CGF.getContext().getCanonicalType(Field->getType());
llvm::Value *ThisPtr = CGF.LoadCXXThis();
- LValue LHS = CGF.EmitLValueForFieldInitialization(ThisPtr, Field, 0);
+ LValue LHS;
// If we are initializing an anonymous union field, drill down to the field.
if (MemberInit->getAnonUnionMember()) {
Field = MemberInit->getAnonUnionMember();
- LHS = CGF.EmitLValueForField(LHS.getAddress(), Field, 0);
+ LHS = CGF.EmitLValueForAnonRecordField(ThisPtr, Field, 0);
FieldType = Field->getType();
+ } else {
+ LHS = CGF.EmitLValueForFieldInitialization(ThisPtr, Field, 0);
}
// FIXME: If there's no initializer and the CXXBaseOrMemberInitializer