summaryrefslogtreecommitdiffstats
path: root/clang/test/CodeGenObjCXX/message.mm
diff options
context:
space:
mode:
authorJohn McCall <rjmccall@apple.com>2013-03-01 09:20:14 +0000
committerJohn McCall <rjmccall@apple.com>2013-03-01 09:20:14 +0000
commit80c93a0793c4c2afab4e5b4155d91f573fe7bd1c (patch)
treefaebf940c69e2d0f3a7a937912f9ab3b1628ae97 /clang/test/CodeGenObjCXX/message.mm
parent323771b3f1970bf7d17c2944bf24248267964c51 (diff)
downloadbcm5719-llvm-80c93a0793c4c2afab4e5b4155d91f573fe7bd1c.tar.gz
bcm5719-llvm-80c93a0793c4c2afab4e5b4155d91f573fe7bd1c.zip
Perform the receiver-expression transformations regardless of
whether we already have a method. Fixes a bug where we were failing to properly contextually convert a message receiver during template instantiation. As a side-effect, we now actually perform correct method lookup after adjusting a message-send to integral or non-ObjC pointer types (legal outside of ARC). rdar://13305374 llvm-svn: 176339
Diffstat (limited to 'clang/test/CodeGenObjCXX/message.mm')
-rw-r--r--clang/test/CodeGenObjCXX/message.mm24
1 files changed, 24 insertions, 0 deletions
diff --git a/clang/test/CodeGenObjCXX/message.mm b/clang/test/CodeGenObjCXX/message.mm
new file mode 100644
index 00000000000..1268a79d63b
--- /dev/null
+++ b/clang/test/CodeGenObjCXX/message.mm
@@ -0,0 +1,24 @@
+// RUN: %clang_cc1 -x objective-c++ -triple x86_64-apple-darwin10 -fobjc-runtime=macosx-10.7 -emit-llvm -o - %s | FileCheck %s
+
+// Properly instantiate a non-dependent message expression which
+// requires a contextual conversion to ObjC pointer type.
+// <rdar://13305374>
+@interface Test0
+- (void) foo;
+@end
+namespace test0 {
+ struct A {
+ operator Test0*();
+ };
+ template <class T> void foo() {
+ A a;
+ [a foo];
+ }
+ template void foo<int>();
+ // CHECK: define weak_odr void @_ZN5test03fooIiEEvv()
+ // CHECK: [[T0:%.*]] = call [[TEST0:%.*]]* @_ZN5test01AcvP5Test0Ev(
+ // CHECK-NEXT: [[T1:%.*]] = load i8**
+ // CHECK-NEXT: [[T2:%.*]] = bitcast [[TEST0]]* [[T0]] to i8*
+ // CHECK-NEXT: call void bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to void (i8*, i8*)*)(i8* [[T2]], i8* [[T1]])
+ // CHECK-NEXT: ret void
+}
OpenPOWER on IntegriCloud