summaryrefslogtreecommitdiffstats
path: root/clang/test/CodeCompletion
diff options
context:
space:
mode:
authorAnders Carlsson <andersca@mac.com>2014-02-28 19:07:22 +0000
committerAnders Carlsson <andersca@mac.com>2014-02-28 19:07:22 +0000
commit382ba41c4802fd3324ff8b9f775ae96fe14a466a (patch)
tree9c1a495c943902f070de595d7cfa2a132c2e9135 /clang/test/CodeCompletion
parent6586e5d6acda639c896351a20e7861276122432c (diff)
downloadbcm5719-llvm-382ba41c4802fd3324ff8b9f775ae96fe14a466a.tar.gz
bcm5719-llvm-382ba41c4802fd3324ff8b9f775ae96fe14a466a.zip
When completing Objective-C instance method invocations, perform a contextual conversion to an Objective-C pointer type of the target expression if needed. This fixes code completion of method invocations where the target is a smart pointer that has an explicit conversion operator to an Objective-C type.
llvm-svn: 202529
Diffstat (limited to 'clang/test/CodeCompletion')
-rw-r--r--clang/test/CodeCompletion/objc-message.mm46
1 files changed, 46 insertions, 0 deletions
diff --git a/clang/test/CodeCompletion/objc-message.mm b/clang/test/CodeCompletion/objc-message.mm
new file mode 100644
index 00000000000..352a18e0da9
--- /dev/null
+++ b/clang/test/CodeCompletion/objc-message.mm
@@ -0,0 +1,46 @@
+// Note: the run lines follow their respective tests, since line/column
+// matter in this test.
+
+@protocol FooTestProtocol
++ protocolClassMethod;
+- protocolInstanceMethod;
+@end
+@interface Foo <FooTestProtocol> {
+ void *isa;
+}
++ (int)classMethod1:a withKeyword:b;
++ (void)classMethod2;
++ new;
+- instanceMethod1;
+@end
+
+@interface Foo (FooTestCategory)
++ categoryClassMethod;
+- categoryInstanceMethod;
+@end
+
+template<typename T> struct RetainPtr {
+ template <typename U> struct RemovePointer { typedef U Type; };
+ template <typename U> struct RemovePointer<U*> { typedef U Type; };
+
+ typedef typename RemovePointer<T>::Type* PtrType;
+
+ explicit operator PtrType() const;
+};
+
+void func(const RetainPtr<Foo>& ptr)
+{
+ [ptr instanceMethod1];
+}
+
+void func(const RetainPtr<id <FooTestProtocol>>& ptr)
+{
+ [ptr instanceMethod1];
+}
+
+// RUN: %clang_cc1 -fsyntax-only -std=c++11 -code-completion-at=%s:33:7 %s -o - | FileCheck -check-prefix=CHECK-CC1 %s
+// CHECK-CC1: categoryInstanceMethod : [#id#]categoryInstanceMethod
+// CHECK-CC1: instanceMethod1 : [#id#]instanceMethod1
+// CHECK-CC1: protocolInstanceMethod : [#id#]protocolInstanceMethod
+// RUN: %clang_cc1 -fsyntax-only -std=c++11 -code-completion-at=%s:38:7 %s -o - | FileCheck -check-prefix=CHECK-CC2 %s
+// CHECK-CC2: protocolInstanceMethod : [#id#]protocolInstanceMethod
OpenPOWER on IntegriCloud