FieldDecl *FD = dyn_cast<FieldDecl>(E->getMemberDecl());
if (!FD) // FIXME: deal with other kinds of member expressions
return APValue();
-
+
+ if (FD->getType()->isReferenceType())
+ return APValue();
+
// FIXME: This is linear time.
unsigned i = 0;
for (RecordDecl::field_iterator Field = RD->field_begin(Info.Ctx),
// Get information about the alignment.
unsigned CharSize = Info.Ctx.Target.getCharWidth();
- // FIXME: Why do we ask for the preferred alignment?
+ // __alignof is defined to return the preferred alignment.
return Info.Ctx.getPreferredTypeAlign(T.getTypePtr()) / CharSize;
}
llvm::PointerType::get(FieldTy, AS),
"tmp");
}
+ if (Field->getType()->isReferenceType())
+ V = Builder.CreateLoad(V, "tmp");
QualType::GCAttrTypes attr = QualType::GCNone;
if (CGM.getLangOptions().ObjC1 &&
--- /dev/null
+// RUN: clang-cc -emit-llvm -o - %s -O2 | grep "@_Z1bv"
+
+// Make sure the call to b() doesn't get optimized out.
+extern struct x {char& x,y;}y;
+int b();
+int a() { if (!&y.x) b(); }