[cfe-commits] r50835 - in /cfe/trunk: lib/CodeGen/CodeGenTypes.cpp test/CodeGen/union.c
Devang Patel
dpatel at apple.com
Wed May 7 15:28:29 PDT 2008
Author: dpatel
Date: Wed May 7 17:28:29 2008
New Revision: 50835
URL: http://llvm.org/viewvc/llvm-project?rev=50835&view=rev
Log:
Begin handling union bitfields.
Note, this is just beginning.
Modified:
cfe/trunk/lib/CodeGen/CodeGenTypes.cpp
cfe/trunk/test/CodeGen/union.c
Modified: cfe/trunk/lib/CodeGen/CodeGenTypes.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenTypes.cpp?rev=50835&r1=50834&r2=50835&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CodeGenTypes.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenTypes.cpp Wed May 7 17:28:29 2008
@@ -593,12 +593,14 @@
unsigned PrimaryEltNo = 0;
std::pair<uint64_t, unsigned> PrimaryElt =
CGT.getContext().getTypeInfo(FieldDecls[0]->getType());
- CGT.addFieldInfo(FieldDecls[0], 0);
+ if (FieldDecls[0]->isBitField())
+ placeBitField(FieldDecls[0]);
+ else
+ CGT.addFieldInfo(FieldDecls[0], 0);
unsigned Size = FieldDecls.size();
for(unsigned i = 1; i != Size; ++i) {
const FieldDecl *FD = FieldDecls[i];
- assert (!FD->isBitField() && "Bit fields are not yet supported");
std::pair<uint64_t, unsigned> EltInfo =
CGT.getContext().getTypeInfo(FD->getType());
@@ -611,7 +613,10 @@
}
// In union, each field gets first slot.
- CGT.addFieldInfo(FD, 0);
+ if (FD->isBitField())
+ placeBitField(FD);
+ else
+ CGT.addFieldInfo(FD, 0);
}
std::vector<const llvm::Type*> Fields;
Modified: cfe/trunk/test/CodeGen/union.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/union.c?rev=50835&r1=50834&r2=50835&view=diff
==============================================================================
--- cfe/trunk/test/CodeGen/union.c (original)
+++ cfe/trunk/test/CodeGen/union.c Wed May 7 17:28:29 2008
@@ -26,3 +26,8 @@
int f3(value v) {
return *v.j;
}
+
+enum E9 { one, two };
+union S65 { enum E9 a:62; } ; union S65 s65;
+void fS65() { enum E9 e = s65.a; }
+
More information about the cfe-commits
mailing list