aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/CGExpr.cpp
diff options
context:
space:
mode:
authorFrancois Pichet <pichet2000@gmail.com>2010-12-04 09:14:42 +0000
committerFrancois Pichet <pichet2000@gmail.com>2010-12-04 09:14:42 +0000
commit00eb3f9c5b33e3d99aee1f8b75dd9c9678fdd66b (patch)
tree7f3cca41dfa3b7d18548218fb444172b38b70ec2 /lib/CodeGen/CGExpr.cpp
parent74e40b70306b39d65fed16d474017df036ff3960 (diff)
More anonymous struct/union redesign. This one deals with anonymous field used in a constructor initializer list:
struct X { X() : au_i1(123) {} union { int au_i1; float au_f1; }; }; clang will now deal with au_i1 explicitly as an IndirectFieldDecl. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120900 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGExpr.cpp')
-rw-r--r--lib/CodeGen/CGExpr.cpp20
1 files changed, 5 insertions, 15 deletions
diff --git a/lib/CodeGen/CGExpr.cpp b/lib/CodeGen/CGExpr.cpp
index 35ba2543ef..5697c5f1a4 100644
--- a/lib/CodeGen/CGExpr.cpp
+++ b/lib/CodeGen/CGExpr.cpp
@@ -1574,23 +1574,13 @@ LValue CodeGenFunction::EmitLValueForBitfield(llvm::Value *BaseValue,
/// that the base value is a pointer to the enclosing record, derive
/// an lvalue for the ultimate field.
LValue CodeGenFunction::EmitLValueForAnonRecordField(llvm::Value *BaseValue,
- const FieldDecl *Field,
+ const IndirectFieldDecl *Field,
unsigned CVRQualifiers) {
- llvm::SmallVector<const FieldDecl *, 8> Path;
- Path.push_back(Field);
-
- while (Field->getParent()->isAnonymousStructOrUnion()) {
- const ValueDecl *VD = Field->getParent()->getAnonymousStructOrUnionObject();
- if (!isa<FieldDecl>(VD)) break;
- Field = cast<FieldDecl>(VD);
- Path.push_back(Field);
- }
-
- llvm::SmallVectorImpl<const FieldDecl*>::reverse_iterator
- I = Path.rbegin(), E = Path.rend();
+ IndirectFieldDecl::chain_iterator I = Field->chain_begin(),
+ IEnd = Field->chain_end();
while (true) {
- LValue LV = EmitLValueForField(BaseValue, *I, CVRQualifiers);
- if (++I == E) return LV;
+ LValue LV = EmitLValueForField(BaseValue, cast<FieldDecl>(*I), CVRQualifiers);
+ if (++I == IEnd) return LV;
assert(LV.isSimple());
BaseValue = LV.getAddress();