[cfe-commits] r86414 - in /cfe/trunk: lib/CodeGen/CGExpr.cpp test/CodeGenCXX/member-expressions.cpp
Anders Carlsson
andersca at mac.com
Sat Nov 7 15:16:50 PST 2009
Author: andersca
Date: Sat Nov 7 17:16:50 2009
New Revision: 86414
URL: http://llvm.org/viewvc/llvm-project?rev=86414&view=rev
Log:
Handle member expressions where the member declaration is actually a static variable. Fixes PR5392.
Added:
cfe/trunk/test/CodeGenCXX/member-expressions.cpp
Modified:
cfe/trunk/lib/CodeGen/CGExpr.cpp
Modified: cfe/trunk/lib/CodeGen/CGExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExpr.cpp?rev=86414&r1=86413&r2=86414&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGExpr.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGExpr.cpp Sat Nov 7 17:16:50 2009
@@ -1155,6 +1155,9 @@
return LV;
}
+ if (VarDecl *VD = dyn_cast<VarDecl>(ND))
+ return EmitGlobalVarDeclLValue(*this, E, VD);
+
assert(false && "Unhandled member declaration!");
return LValue();
}
Added: cfe/trunk/test/CodeGenCXX/member-expressions.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/member-expressions.cpp?rev=86414&view=auto
==============================================================================
--- cfe/trunk/test/CodeGenCXX/member-expressions.cpp (added)
+++ cfe/trunk/test/CodeGenCXX/member-expressions.cpp Sat Nov 7 17:16:50 2009
@@ -0,0 +1,19 @@
+// RUN: clang-cc -emit-llvm %s -o - -triple=x86_64-apple-darwin10 | FileCheck %s
+
+// PR5392
+namespace PR5392 {
+struct A
+{
+ static int a;
+};
+
+A a1;
+void f()
+{
+ // CHECK: store i32 10, i32* @_ZN6PR53921A1aE
+ a1.a = 10;
+ // CHECK: store i32 20, i32* @_ZN6PR53921A1aE
+ A().a = 20;
+}
+
+}
More information about the cfe-commits
mailing list