[cfe-commits] r105391 - in /cfe/trunk: lib/CodeGen/CGExprConstant.cpp test/CodeGenCXX/pointers-to-data-members.cpp
Anders Carlsson
andersca at mac.com
Thu Jun 3 08:36:07 PDT 2010
Author: andersca
Date: Thu Jun 3 10:36:07 2010
New Revision: 105391
URL: http://llvm.org/viewvc/llvm-project?rev=105391&view=rev
Log:
Don't try to explicitly zero out bit-fields.
Modified:
cfe/trunk/lib/CodeGen/CGExprConstant.cpp
cfe/trunk/test/CodeGenCXX/pointers-to-data-members.cpp
Modified: cfe/trunk/lib/CodeGen/CGExprConstant.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExprConstant.cpp?rev=105391&r1=105390&r2=105391&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGExprConstant.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGExprConstant.cpp Thu Jun 3 10:36:07 2010
@@ -1117,6 +1117,11 @@
for (RecordDecl::field_iterator I = RD->field_begin(),
E = RD->field_end(); I != E; ++I) {
const FieldDecl *FD = *I;
+
+ // Ignore bit fields.
+ if (FD->isBitField())
+ continue;
+
unsigned FieldNo = Layout.getLLVMFieldNo(FD);
Elements[FieldNo] = EmitNullConstant(FD->getType());
}
Modified: cfe/trunk/test/CodeGenCXX/pointers-to-data-members.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/pointers-to-data-members.cpp?rev=105391&r1=105390&r2=105391&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenCXX/pointers-to-data-members.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/pointers-to-data-members.cpp Thu Jun 3 10:36:07 2010
@@ -172,3 +172,14 @@
D d;
}
+
+namespace Test1 {
+
+// Don't crash when A contains a bit-field.
+struct A {
+ int A::* a;
+ int b : 10;
+};
+A a;
+
+}
More information about the cfe-commits
mailing list