[cfe-commits] r79790 - in /cfe/trunk: lib/CodeGen/CGExprConstant.cpp test/CodeGenCXX/member-pointers-zero-init.cpp
Anders Carlsson
andersca at mac.com
Sat Aug 22 17:02:11 PDT 2009
Author: andersca
Date: Sat Aug 22 19:02:11 2009
New Revision: 79790
URL: http://llvm.org/viewvc/llvm-project?rev=79790&view=rev
Log:
Handle CK_NullToMemberPointer casts in the constant expr emitter.
Modified:
cfe/trunk/lib/CodeGen/CGExprConstant.cpp
cfe/trunk/test/CodeGenCXX/member-pointers-zero-init.cpp
Modified: cfe/trunk/lib/CodeGen/CGExprConstant.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExprConstant.cpp?rev=79790&r1=79789&r2=79790&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGExprConstant.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGExprConstant.cpp Sat Aug 22 19:02:11 2009
@@ -414,6 +414,8 @@
llvm::StructType::get(C->getType()->getContext(), Types, false);
return llvm::ConstantStruct::get(STy, Elts);
}
+ case CastExpr::CK_NullToMemberPointer:
+ return CGM.EmitNullConstant(E->getType());
default: {
// FIXME: This should be handled by the CK_NoOp cast kind.
// Explicit and implicit no-op casts
Modified: cfe/trunk/test/CodeGenCXX/member-pointers-zero-init.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/member-pointers-zero-init.cpp?rev=79790&r1=79789&r2=79790&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenCXX/member-pointers-zero-init.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/member-pointers-zero-init.cpp Sat Aug 22 19:02:11 2009
@@ -7,12 +7,15 @@
// RUN: grep "@a = global i64 -1" %t &&
int A::* a;
-// RUN: grep "@aa = global \[2 x i64\] \[i64 -1, i64 -1\], align 8" %t &&
+// RUN: grep "@aa = global \[2 x i64\] \[i64 -1, i64 -1\]" %t &&
int A::* aa[2];
// RUN: grep "@aaa = global \[2 x \[2 x i64\]\] \[\[2 x i64\] \[i64 -1, i64 -1\], \[2 x i64\] \[i64 -1, i64 -1\]\]" %t &&
int A::* aaa[2][2];
+// RUN: grep "@b = global i64 -1" %t &&
+int A::* b = 0;
+
void f() {
// RUN: grep "%.obool = icmp ne i64 %.mp, -1" %t
if (a) { }
More information about the cfe-commits
mailing list