summaryrefslogtreecommitdiffstats
path: root/clang/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
commitc4094935c002dffa3f3c376127c23b5be68829ba (patch)
tree242519351adfda7d2eeb037cd910acd1858031bd /clang/lib/CodeGen/CGClass.cpp
parent61925b03ccae097ec6516667d02d6838a2ec7181 (diff)
downloadbcm5719-llvm-c4094935c002dffa3f3c376127c23b5be68829ba.tar.gz
bcm5719-llvm-c4094935c002dffa3f3c376127c23b5be68829ba.zip
When emitting an lvalue for an anonymous struct or union member during
class initialization, drill down through an arbitrary number of anonymous records. llvm-svn: 104310
Diffstat (limited to 'clang/lib/CodeGen/CGClass.cpp')
-rw-r--r--clang/lib/CodeGen/CGClass.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/clang/lib/CodeGen/CGClass.cpp b/clang/lib/CodeGen/CGClass.cpp
index 72d95b8556c..82c72288d91 100644
--- a/clang/lib/CodeGen/CGClass.cpp
+++ b/clang/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
OpenPOWER on IntegriCloud