mirror of https://github.com/microsoft/clang.git
[libclang] Fix code-completion of block parameters that are marked with nullability specifier.
rdar://20755276 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@241558 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
11354e9dc8
commit
0316e7d76c
|
@ -2204,6 +2204,11 @@ static std::string FormatFunctionParameter(const PrintingPolicy &Policy,
|
|||
TL = QualifiedTL.getUnqualifiedLoc();
|
||||
continue;
|
||||
}
|
||||
|
||||
if (AttributedTypeLoc AttrTL = TL.getAs<AttributedTypeLoc>()) {
|
||||
TL = AttrTL.getModifiedLoc();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
// Try to get the function prototype behind the block pointer type,
|
||||
|
|
|
@ -42,6 +42,14 @@ void test_D(D *d) {
|
|||
[d method6:0];
|
||||
}
|
||||
|
||||
@interface I1
|
||||
- method7:(int (^_Nullable)(int x, int y))b;
|
||||
@end
|
||||
void f2(int (^_Nullable block)(int x, int y));
|
||||
void test_f2(I1 *o) {
|
||||
[o method7:0];
|
||||
}
|
||||
|
||||
// RUN: c-index-test -code-completion-at=%s:8:1 %s | FileCheck -check-prefix=CHECK-CC1 %s
|
||||
// CHECK-CC1: FunctionDecl:{ResultType void}{TypedText f}{LeftParen (}{Placeholder ^int(int x, int y)block}{RightParen )} (50)
|
||||
// CHECK-CC1: FunctionDecl:{ResultType void}{TypedText g}{LeftParen (}{Placeholder ^(float f, double d)b}{RightParen )} (50)
|
||||
|
@ -62,3 +70,7 @@ void test_D(D *d) {
|
|||
// RUN: c-index-test -code-completion-at=%s:42:6 %s | FileCheck -check-prefix=CHECK-CC6 %s
|
||||
// CHECK-CC6: ObjCInstanceMethodDecl:{ResultType id}{TypedText method6:}{Placeholder ^(block_t block)arg} (35)
|
||||
|
||||
// RUN: c-index-test -code-completion-at=%s:50:1 %s | FileCheck -check-prefix=CHECK-CC7 %s
|
||||
// CHECK-CC7: FunctionDecl:{ResultType void}{TypedText f2}{LeftParen (}{Placeholder ^int(int x, int y)block}{RightParen )} (50)
|
||||
// RUN: c-index-test -code-completion-at=%s:50:6 %s | FileCheck -check-prefix=CHECK-CC8 %s
|
||||
// CHECK-CC8: ObjCInstanceMethodDecl:{ResultType id}{TypedText method7:}{Placeholder ^int(int x, int y)b} (35)
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
}
|
||||
-(U)getit:(T)val;
|
||||
-(void)apply:(void(^)(T, U))block;
|
||||
-(void)apply2:(void(^__nonnull)(T, U))block;
|
||||
|
||||
@property (strong) T prop;
|
||||
@end
|
||||
|
@ -32,22 +33,24 @@ void test2(Test *obj) {
|
|||
obj->;
|
||||
}
|
||||
|
||||
// RUN: c-index-test -code-completion-at=%s:24:8 %s | FileCheck -check-prefix=CHECK-CC0 %s
|
||||
// RUN: c-index-test -code-completion-at=%s:25:8 %s | FileCheck -check-prefix=CHECK-CC0 %s
|
||||
// CHECK-CC0: ObjCInstanceMethodDecl:{ResultType void}{TypedText apply2:}{Placeholder ^(MyClsA *, MyClsB *)block} (35)
|
||||
// CHECK-CC0: ObjCInstanceMethodDecl:{ResultType void}{TypedText apply:}{Placeholder ^(MyClsA *, MyClsB *)block} (35)
|
||||
// CHECK-CC0: ObjCInstanceMethodDecl:{ResultType MyClsB *}{TypedText getit:}{Placeholder (MyClsA *)} (35)
|
||||
|
||||
// RUN: c-index-test -code-completion-at=%s:25:7 %s | FileCheck -check-prefix=CHECK-CC1 %s
|
||||
// RUN: c-index-test -code-completion-at=%s:26:7 %s | FileCheck -check-prefix=CHECK-CC1 %s
|
||||
// CHECK-CC1: ObjCPropertyDecl:{ResultType MyClsA *}{TypedText prop} (35)
|
||||
|
||||
// RUN: c-index-test -code-completion-at=%s:26:8 %s | FileCheck -check-prefix=CHECK-CC2 %s
|
||||
// RUN: c-index-test -code-completion-at=%s:27:8 %s | FileCheck -check-prefix=CHECK-CC2 %s
|
||||
// CHECK-CC2: ObjCIvarDecl:{ResultType MyClsB *}{TypedText myVar} (35)
|
||||
|
||||
// RUN: c-index-test -code-completion-at=%s:30:8 %s | FileCheck -check-prefix=CHECK-CC3 %s
|
||||
// RUN: c-index-test -code-completion-at=%s:31:8 %s | FileCheck -check-prefix=CHECK-CC3 %s
|
||||
// CHECK-CC3: ObjCInstanceMethodDecl:{ResultType void}{TypedText apply2:}{Placeholder ^(id, NSObject *)block} (35)
|
||||
// CHECK-CC3: ObjCInstanceMethodDecl:{ResultType void}{TypedText apply:}{Placeholder ^(id, NSObject *)block} (35)
|
||||
// CHECK-CC3: ObjCInstanceMethodDecl:{ResultType __kindof NSObject *}{TypedText getit:}{Placeholder (id)} (35)
|
||||
|
||||
// RUN: c-index-test -code-completion-at=%s:31:7 %s | FileCheck -check-prefix=CHECK-CC4 %s
|
||||
// RUN: c-index-test -code-completion-at=%s:32:7 %s | FileCheck -check-prefix=CHECK-CC4 %s
|
||||
// CHECK-CC4: ObjCPropertyDecl:{ResultType id}{TypedText prop} (35)
|
||||
|
||||
// RUN: c-index-test -code-completion-at=%s:32:8 %s | FileCheck -check-prefix=CHECK-CC5 %s
|
||||
// RUN: c-index-test -code-completion-at=%s:33:8 %s | FileCheck -check-prefix=CHECK-CC5 %s
|
||||
// CHECK-CC5: ObjCIvarDecl:{ResultType __kindof NSObject *}{TypedText myVar} (35)
|
||||
|
|
Loading…
Reference in New Issue