diff options
| author | Alex Lorenz <arphaman@gmail.com> | 2017-11-08 22:44:34 +0000 |
|---|---|---|
| committer | Alex Lorenz <arphaman@gmail.com> | 2017-11-08 22:44:34 +0000 |
| commit | 1ee711633dfdd1fe4e94926723c92ec25ebab9f5 (patch) | |
| tree | 86caa6ef704568e5bd44b2a9133293f0af8d8334 /clang/test/SemaObjC | |
| parent | 2fd314e2e2e6193722ba5ef4b6b01ae40feeb1fe (diff) | |
| download | bcm5719-llvm-1ee711633dfdd1fe4e94926723c92ec25ebab9f5.tar.gz bcm5719-llvm-1ee711633dfdd1fe4e94926723c92ec25ebab9f5.zip | |
[ObjC] Fix function signature handling for blocks literals with attributes
Block literals can have a type with attributes in its signature, e.g.
ns_returns_retained. The code that inspected the type loc of the block when
declaring its parameters didn't account for this fact, and only looked through
paren type loc. This commit ensures that getAsAdjusted is used instead of
IgnoreParens to find the block's FunctionProtoTypeLoc. This ensures that
block parameters are declared correctly in the block and avoids the
'undeclared identifier' error.
rdar://35416160
llvm-svn: 317736
Diffstat (limited to 'clang/test/SemaObjC')
| -rw-r--r-- | clang/test/SemaObjC/block-literal-with-attribute.m | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/clang/test/SemaObjC/block-literal-with-attribute.m b/clang/test/SemaObjC/block-literal-with-attribute.m new file mode 100644 index 00000000000..24ef2aafa87 --- /dev/null +++ b/clang/test/SemaObjC/block-literal-with-attribute.m @@ -0,0 +1,15 @@ +// RUN: %clang_cc1 -fsyntax-only %s -verify -fblocks -fobjc-arc +// RUN: %clang_cc1 -fsyntax-only %s -verify -fblocks +// FIXME: should compile + +__auto_type block = ^ id __attribute__((ns_returns_retained)) (id filter) { + return filter; // ok +}; +__auto_type block2 = ^ __attribute__((ns_returns_retained)) id (id filter) { + return filter; // ok +}; +__auto_type block3 = ^ id (id filter) __attribute__((ns_returns_retained)) { + return filter; // ok +}; + +// expected-no-diagnostics |

