[cfe-commits] r113079 - in /cfe/trunk: lib/CodeGen/CGExprScalar.cpp test/CodeGenObjC/property-ref-cast-to-void.m
Fariborz Jahanian
fjahanian at apple.com
Sat Sep 4 12:49:18 PDT 2010
Author: fjahanian
Date: Sat Sep 4 14:49:18 2010
New Revision: 113079
URL: http://llvm.org/viewvc/llvm-project?rev=113079&view=rev
Log:
Casting of a property reference to 'void' did not
generate the necessary code. This patch fixes it.
// rdar://8389655
Added:
cfe/trunk/test/CodeGenObjC/property-ref-cast-to-void.m
Modified:
cfe/trunk/lib/CodeGen/CGExprScalar.cpp
Modified: cfe/trunk/lib/CodeGen/CGExprScalar.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExprScalar.cpp?rev=113079&r1=113078&r2=113079&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGExprScalar.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGExprScalar.cpp Sat Sep 4 14:49:18 2010
@@ -1038,8 +1038,13 @@
return Builder.CreatePtrToInt(Src, ConvertType(DestTy));
}
case CK_ToVoid: {
- if (E->Classify(CGF.getContext()).isGLValue())
- CGF.EmitLValue(E);
+ if (E->Classify(CGF.getContext()).isGLValue()) {
+ LValue LV = CGF.EmitLValue(E);
+ if (LV.isPropertyRef())
+ CGF.EmitLoadOfPropertyRefLValue(LV, E->getType());
+ else if (LV.isKVCRef())
+ CGF.EmitLoadOfKVCRefLValue(LV, E->getType());
+ }
else
CGF.EmitAnyExpr(E, 0, false, true);
return 0;
Added: cfe/trunk/test/CodeGenObjC/property-ref-cast-to-void.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenObjC/property-ref-cast-to-void.m?rev=113079&view=auto
==============================================================================
--- cfe/trunk/test/CodeGenObjC/property-ref-cast-to-void.m (added)
+++ cfe/trunk/test/CodeGenObjC/property-ref-cast-to-void.m Sat Sep 4 14:49:18 2010
@@ -0,0 +1,18 @@
+// RUN: %clang_cc1 -triple x86_64-apple-darwin9 -emit-llvm -o - %s | FileCheck %s
+// RUN: %clang_cc1 -x objective-c++ -triple x86_64-apple-darwin9 -emit-llvm -o - %s | FileCheck %s
+
+// rdar: // 8399655
+ at interface TestClass
+ at property (readonly) int myProperty;
+- (int)myProperty;
+- (double)myGetter;
+ at end
+
+void FUNC () {
+ TestClass *obj;
+ (void)obj.myProperty;
+ (void)obj.myGetter;
+}
+
+// CHECK: call i32 bitcast
+// CHECK: call double bitcast
More information about the cfe-commits
mailing list